SlideShare a Scribd company logo
1 of 43
Golang Workshop
SAGAR PANDA KABEER SHAIKH
Agenda
❖ Small talks and networking
❖ Introduction to Golang
❖ Why Golang
❖ Trends
❖ Golang Syntax & Hello World
❖ Implementing chatbot
❖ QA
Introduction
“Go will be the server language of the future.”
— Tobias Lütke,
CEO - Shopify
Creators
Created by Google Inc in 2009 by:
● Ken Thompson (B, C, UNIX, UTF-8),
● Rob Pike(UNIX, UTF-8) and
● Robert Griesmer (HotSpot, JVM)
● Procedural and imperative
● Object-oriented - Yes and No
● Compiled
● Syntax similar to C-family
● Concurrency inspired by CSP
Nature
Why they created Go?
● Frustration with existing language
● Had to choose either efficient compilation, efficient execution or ease of
programming
● Dynamic typed (Python,JavaScript): easy +ve, safety -ve, efficiency -ve
● Compiled ( C ) are fast, but difficult to work and not safe
● Interpreted (Ruby) safe but slower
● Libraries and tools cannot address issues like lightweight type system,
concurrency and garbage collection, rigid dependency specification and
so on
Go removes all obstacles
Fast: fast compilation like interpreted language
Safe: Strongly and statically typed and garbage collected
Easy: Concise , easy to read
Modern: Built in support for multi-core networked distributed applications
Why learn or switch to Golang?
Go has the cutest mascot
GO GO GO...
● Overcoming hardware limitations
● Go’s Goroutines
● Go runs directly on underlying hardware
● Easy to maintain
● Best for microservices
Overcoming hardware limitations
● 2000 - 1st P-4 processor with 1.4 GHz clock speed,
● 2004 - with 3.0GHz clock speed
● 2014 - Core i7 4790K with 4.0Ghz clock speed
● Manufacturers added multiple cores, hyper-threading technology, more
cache
● Limitations on adding more h/w, cannot rely on hardware for
performance
● Multi-core processors run multiple threads simultaneously - Go captures
concurrency
Go’s Goroutines
● Today's applications use multiple microservices which needs easy
concurrency and scalability with increase no of cores
● Modern prog lang (like Java,Python etc) - 90’s single threaded
environment
● They support multi-threading but problems with concurrent execution,
threading-locking, race conditions and deadlocks
● Creating new thread in Java is not memory efficient, 1 thread = 1mb
memory of heap size
● Golang created in 2009 under multiple core processors. 1 thread = 2Kb
Go’s Goroutines
● Growable segmented stacks - use more memory only when needed.
● Faster startup time than threads
● Come with built-in primitives to communicate safely between themselves
(channels)
● Goroutines and OS threads do not have 1:1 mapping. A single goroutine
can run on multiple threads
Gos Goroutines
Go runs directly on underlying hardware
Execution steps for VM based languages Execution steps for compiled languages
Easy to maintain
● No classes: Go has only structs instead of classes
● Does not support inheritance: Make code easy to modify. In other
languages like Java/Python, if the class ABC inherits class XYZ and you
make some changes in class XYZ, then that may produce some side
effects in other classes that inherit XYZ. By removing inheritance, Go
makes it easy to understand the code also
● No constructors
● No assertions
● No generics
● No exceptions
Easy to maintain
Best suitable for microservices
● Lightweight, very fast
● Fantastic support for concurrency, which is a powerful capability when
running across several machines and cores
● Microservice framework like go-micro or go-kit
● Pluggable architecture based on RPC - gRPC
Trends - Major Companies using Golang
Trends - % of Stack Overflow question for Go
Source: https://insights.stackoverflow.com/trends?tags=go
Trends - Most used and wanted languages in 2017
Source:
https://www.stackoverflowbusiness.com/hubfs/content/2017_Global_Developer_Hiring_Landscape.
pdf
Trends - Popularity
Source: http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17/
Trends - Programming language Hall of Fame
Source: https://www.tiobe.com/tiobe-index/
Syntax
C Java Go
Extension .c .java .go
VM Needed Not needed JVM is there to
convert java files
to class files
Not needed
Compiler TurboC javac gc
Program
Execution
Starts from
main() function
Starts from
public static void
main(String[ ]
args)
starts from
func main() and
should be in
package main
Syntax
C Java Go
Variable
Declaration
int a; float b;
int a,b,c;
Initialization
int a=25;
char c=’a’;
int a; float b; a int
var c string
var a,b,c float
Initialization
var o,p int=34,65
k=45.67 (type of variable
auto judged by
compiler)
Shorthand notation
a:=30 (only inside
function)
Data Types bytes,short,int,long,
double,float,char,void
Primitive
bytes,short,int,long
,double,float,
boolean,char
uint, int,float32,...,
complex, byte,rune
C Java Go
Constant const int LEN=10 final int PI=3.14 const LEN int=10
Operators All operators like
Arithmetic,Logical,
Bitwise etc. are
same
All operators like
Arithmetic,Logical,
Bitwise etc. are
same
All operators like
Arithmetic,Logical,
Bitwise etc. are
same
Decision Making
Statements
(If else)
if(i>5){
flag=true
}
else{
flag=false
}
if(i>5){
flag=true
}
else{
flag=false
}
if i>5{
flag=true
}else{
flag=false
}
Syntax
C Java Go
Switch Case switch(i){
case 1: ……
break;
.
.
default:.....
break ;
}
switch(i){
case 1: ……
break;
.
.
default:.....
break ;
}
Expression switch
switch marks{
case 90: grade==’A’
case 50,60,70:grade==’C .
default: fmt.Println(“Invalid”)
}
Type switch
var x interface{}
switch x.(type){
case int:
fmt.Println(“x is int”)
default:
fmt.Println(“I don’t know”)
}
Syntax
C Java Go
For loop for(i=1;i<5;i++){
……...
}
for(i=1;i<5;i++){
…………..
}
for i:=0;i<5;i++{
………..
}
for key,val:=range
numbers{
…………..
}
While Loop while(i<10){
i++;
}
while(i<10){
i++;
}
for sum<100{
sum+=sum
}
Syntax
C Java Go
Function Declaration
int sum(int,int)
int sum(int x,int y){
……………
return
}
Calling
int add;
add=sum(10,20)
-Supports pass by
value and reference
Define method
public int sum(int
a,int b){
…………..
return
}
-Only pass by value
func sum(no int)
(int){
……
return ..
}
-Both pass by value
and reference
Function
Overloading
No Yes No
Syntax
C Java Go
Variadic Functions No printMax(10,20,30)
public static void
printMax(double…
numbers){
……...
}
func sum(num
...int) int{
…..
….
}
Ex. Println() is
implemented in
“fmt”
package
func Println(a
...interface{})(n
int,err error)
String char greet[6]={
‘h’,’e’,’l’,’l’,’o’,’0’
}
String s=new
String(“Hello”)
var
greeting=”Hello”
Syntax
C Java Go
String Functions strcpy(str1, str2)
strcat(str1,str2)
strlen(s1)............
str.length()
str.concat(str2)
str.compareTo(str2
)
String is made up
of runes. Rune is
UTF Format (A-
’65’,a-’97’)
len(str)
strings.join(str1,str
2)
Arrays Fixed size data
structure
Declaration
int array[10];
Accessing Elements
int value=array[10]
Declaration
int[ ] numbers
Creation
numbers=new
int[10]
Declaration
var number [10]int
Initialization
Var bal=[10]
int{...............}
Syntax
C Java Go
Slice There is no growable
data structure
java.util.Collection
package provides
dynamic growable
array. E.g List,Set,Map
etc
Growable data
structure
Declaration
var numbers []int
Creation
numbers=make([
]int,5,5)
5 len, 5 is capacity
append(),copy()
Default value - nil
Map There is no map data
structure in C
Key, Value pair
Map m=new
HashMap()
Map[key] value
Default value is nil
Syntax
C Java Go
Map - m.put(“Zero”,1)
put( )
get( )
ForEach to iterate
over collection and
array
var dictionary=map
[string] int
dictionary[“Zero”]=1
Create using make
var dict=make(map
[string] int)
Range -> to iterate over
slice,map
for key,val:=range values
{
……...
}
Syntax
C Java Go
Struct / Class Collection of fields and
methods
struct book{
int id;
char name[50];
char author[50];
}book;
//Access members
struct book book1;
strcpy(book1.id,400)
Java does not have
struct but have
class
class Books{
int id;
String name;
String author;
void display(){
…………...
}
}
Books b=new
Book();
b.name=”Vision”
Go have struct to
hold data in
variables.
type struct Book{
id int;
name string;
}
func(book3 *Book)
display() {
…………..
}
book1:=new(Book)
var book2 Book;
book2.name=”Go”
Syntax
C Java Go
Embedding It is like inheritance
in Java
class A {
….
}
Class B extends A
{
...
}
type Person struct{
Name string
}
func (per *Person)
speak(){
……..
}
type Mobile struct{
Person
Model String
}
Mob:=new(Mobile)
mob.Person.speak(
)
Syntax
C Java Go
Pointer Direct address of
memory location
int *a
a=&b;
NULL pointer
Always assign null
value to pointer
variable when you
don’t know exact
address to assign
int *a=NULL;
Java does not
support pointer
var a *int
var fp *float32
a=&p
NIL pointer
var *p int=nil
Syntax
C Java Go
Interface C does not have
interface concept
-Collection of only abstract
methods (from java 8 it
supports static methods
also)
-Classes implements
interface
public interface Animal{
public void eat();
public void sleep();
}
public class Monkey extends
Animal{
………..
}
-Provides method
signatures
type Shape
interface {
area() float64
}
type square struct{
side float64
}
func(sq Square)area( )
float64 {
return sq.side*sq.side
}
Same method signature
is implemented
Syntax
C Java Go
Go has empty interface which is like
object class in java. An empty
interface can hold any type of
value.
fmt.Println(a ...interface{ })
Type Casting Convert variable from
one to another data type
(type) expression
int sum=5,count=2;
Double d=(double)
sum/count
Widening
byte->short->int->float->
long->double
float=10
Narrowing
double->float->long->int-
>short->byte
int a=(float)10.40
var i int=10
var f float64=6.44
fmt.Println(float64(i))
fmt.Println(int(f))
Syntax
C Java Go
Error Handling -No direct support for error
handling
But it returns error no.
perror() and strerror() used to
display text message associated
with error no
int dividend=20;
int divisor=0;
int quotient;
if(divisor==0){
fprintf(stderr,”Divide by zero”);
exit(-1);
}
Exception Handling
-Exception is problem
arises during program
execution.
Checked/Unchecked Ex.
try{
……
}
catch(Exception ex){
……..
}
finally{
……..
}
No try/catch mechanism.
Instead it is having
defer,panic,recover
concepts.
-Provides error interface
type error interface{
Error() string
}
Normally function
returns error as last
return value. Use
errors.New() for
specifying error msg.
Syntax
C Java Go
Concurrency /
Multithreading
Doesn’t have
support.
Java have multithreading
concept for simultaneous
execution of different
tasks at same time.
We need to extends
Thread class or Runnable
interface and then
implement run( ) and write
your code
start(),run(),join(),sleep(),...
Here, we use
goroutines for
concurrent
execution.
To make function
as goroutine just
append go in front
of your function.
Two goroutines are
communicating
using channel
concept
Syntax
Thank You!
Drop us an email if you any doubts contact@mindbowser.com

More Related Content

What's hot

APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...Tchelinux
 
Programando em C++ // Estrutura Básica
Programando em C++ // Estrutura Básica Programando em C++ // Estrutura Básica
Programando em C++ // Estrutura Básica Yuri Camelo
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about CYi-Hsiu Hsu
 
Threads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonThreads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonYi-Lung Tsai
 
가상화된 코드를 분석해보자
가상화된 코드를 분석해보자가상화된 코드를 분석해보자
가상화된 코드를 분석해보자dkswognsdi
 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitabilityFFRI, Inc.
 
KFServing and Kubeflow Pipelines
KFServing and Kubeflow PipelinesKFServing and Kubeflow Pipelines
KFServing and Kubeflow PipelinesAnimesh Singh
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsStormpath
 
Snap 1 - introduccion a la herramienta snap
Snap 1 -  introduccion a la herramienta snapSnap 1 -  introduccion a la herramienta snap
Snap 1 - introduccion a la herramienta snapProgramamos
 
Materi fungsi dalam bahasa c++
Materi fungsi  dalam bahasa c++Materi fungsi  dalam bahasa c++
Materi fungsi dalam bahasa c++Ana Tolirenisa
 
Desarrollando software para Alfresco (keensoft)
Desarrollando software para Alfresco (keensoft)Desarrollando software para Alfresco (keensoft)
Desarrollando software para Alfresco (keensoft)Angel Borroy López
 
Criando testes unitários com Junit 5
Criando testes unitários com Junit 5Criando testes unitários com Junit 5
Criando testes unitários com Junit 5Deivid Hahn Fração
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developersPatrick Savalle
 
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...Kim Hammar
 

What's hot (20)

APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
 
Programando em C++ // Estrutura Básica
Programando em C++ // Estrutura Básica Programando em C++ // Estrutura Básica
Programando em C++ // Estrutura Básica
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Threads and Callbacks for Embedded Python
Threads and Callbacks for Embedded PythonThreads and Callbacks for Embedded Python
Threads and Callbacks for Embedded Python
 
Pascal öGren
Pascal öGrenPascal öGren
Pascal öGren
 
가상화된 코드를 분석해보자
가상화된 코드를 분석해보자가상화된 코드를 분석해보자
가상화된 코드를 분석해보자
 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitability
 
KFServing and Kubeflow Pipelines
KFServing and Kubeflow PipelinesKFServing and Kubeflow Pipelines
KFServing and Kubeflow Pipelines
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
Django In The Real World
Django In The Real WorldDjango In The Real World
Django In The Real World
 
Vulkan 1.1 Reference Guide
Vulkan 1.1 Reference GuideVulkan 1.1 Reference Guide
Vulkan 1.1 Reference Guide
 
Snap 1 - introduccion a la herramienta snap
Snap 1 -  introduccion a la herramienta snapSnap 1 -  introduccion a la herramienta snap
Snap 1 - introduccion a la herramienta snap
 
Linguagem Dart (Google)
Linguagem Dart (Google)Linguagem Dart (Google)
Linguagem Dart (Google)
 
Golang
GolangGolang
Golang
 
Materi fungsi dalam bahasa c++
Materi fungsi  dalam bahasa c++Materi fungsi  dalam bahasa c++
Materi fungsi dalam bahasa c++
 
Android - Conceito e Arquitetura
Android - Conceito e ArquiteturaAndroid - Conceito e Arquitetura
Android - Conceito e Arquitetura
 
Desarrollando software para Alfresco (keensoft)
Desarrollando software para Alfresco (keensoft)Desarrollando software para Alfresco (keensoft)
Desarrollando software para Alfresco (keensoft)
 
Criando testes unitários com Junit 5
Criando testes unitários com Junit 5Criando testes unitários com Junit 5
Criando testes unitários com Junit 5
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...
Kim Hammar - Feature Store: the missing data layer in ML pipelines? - HopsML ...
 

Similar to Golang workshop - Mindbowser

Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go langAmal Mohan N
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Michał Konarski
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Ganesh Samarthyam
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageGanesh Samarthyam
 
Introduction to go, and why it's awesome
Introduction to go, and why it's awesomeIntroduction to go, and why it's awesome
Introduction to go, and why it's awesomeJanet Kuo
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with goVimlesh Sharma
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James NelsonGWTcon
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIYoni Davidson
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
Advantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworksAdvantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworksKaty Slemon
 
Introduction To Apache Pig at WHUG
Introduction To Apache Pig at WHUGIntroduction To Apache Pig at WHUG
Introduction To Apache Pig at WHUGAdam Kawa
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 
Modern Web development and operations practices
Modern Web development and operations practicesModern Web development and operations practices
Modern Web development and operations practicesGrig Gheorghiu
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 

Similar to Golang workshop - Mindbowser (20)

Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Introduction to go, and why it's awesome
Introduction to go, and why it's awesomeIntroduction to go, and why it's awesome
Introduction to go, and why it's awesome
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-API
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Advantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworksAdvantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworks
 
Introduction To Apache Pig at WHUG
Introduction To Apache Pig at WHUGIntroduction To Apache Pig at WHUG
Introduction To Apache Pig at WHUG
 
Golang
GolangGolang
Golang
 
Java for C++ programers
Java for C++ programersJava for C++ programers
Java for C++ programers
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 
Modern Web development and operations practices
Modern Web development and operations practicesModern Web development and operations practices
Modern Web development and operations practices
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 

More from Mindbowser Inc

Healthcare Technology Survey 2023
Healthcare Technology Survey 2023Healthcare Technology Survey 2023
Healthcare Technology Survey 2023Mindbowser Inc
 
Top DevOps Trends And Statistics You Need To Know In 2023
Top DevOps Trends And Statistics You Need To Know In 2023Top DevOps Trends And Statistics You Need To Know In 2023
Top DevOps Trends And Statistics You Need To Know In 2023Mindbowser Inc
 
How To Achieve Project Success With Your Outsourced Team?
How To Achieve Project Success With Your Outsourced Team?How To Achieve Project Success With Your Outsourced Team?
How To Achieve Project Success With Your Outsourced Team?Mindbowser Inc
 
Data Science Consulting: From Idea To Deployment
Data Science Consulting: From Idea To DeploymentData Science Consulting: From Idea To Deployment
Data Science Consulting: From Idea To DeploymentMindbowser Inc
 
Understanding The Difference Between RPO And Staff Augmentation
Understanding The Difference Between RPO And Staff AugmentationUnderstanding The Difference Between RPO And Staff Augmentation
Understanding The Difference Between RPO And Staff AugmentationMindbowser Inc
 
Top 5 Benefits Of IT Staff Augmentation For Modern Businesses
Top 5 Benefits Of IT Staff Augmentation For Modern BusinessesTop 5 Benefits Of IT Staff Augmentation For Modern Businesses
Top 5 Benefits Of IT Staff Augmentation For Modern BusinessesMindbowser Inc
 
How To Select The Right Software Architecture For Your Healthcare Product?
How To Select The Right Software Architecture For Your Healthcare Product?How To Select The Right Software Architecture For Your Healthcare Product?
How To Select The Right Software Architecture For Your Healthcare Product?Mindbowser Inc
 
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!Agile Scrum Mastery: Learn How To Bring Complex Projects To life!
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!Mindbowser Inc
 
A Guide To Minimum Viable Architecture Points For Any Startup
A Guide To Minimum Viable Architecture Points For Any StartupA Guide To Minimum Viable Architecture Points For Any Startup
A Guide To Minimum Viable Architecture Points For Any StartupMindbowser Inc
 
Benefits and challenges of ehr
Benefits and challenges of ehrBenefits and challenges of ehr
Benefits and challenges of ehrMindbowser Inc
 
What To Choose Between - Native App And Hybrid Mobile App
What To Choose Between - Native App And Hybrid Mobile AppWhat To Choose Between - Native App And Hybrid Mobile App
What To Choose Between - Native App And Hybrid Mobile AppMindbowser Inc
 
7 Secret Reasons To Choose An Outsourced Agency?
7 Secret Reasons To Choose An Outsourced Agency?7 Secret Reasons To Choose An Outsourced Agency?
7 Secret Reasons To Choose An Outsourced Agency?Mindbowser Inc
 
How We Thrill Customers?
How We Thrill Customers?How We Thrill Customers?
How We Thrill Customers?Mindbowser Inc
 
Benefits and Challenges of EHR
Benefits and Challenges of EHRBenefits and Challenges of EHR
Benefits and Challenges of EHRMindbowser Inc
 
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...Mindbowser Inc
 
Get Ready For What's New In Insurance Technology Trends For 2021
Get Ready For What's New In Insurance Technology Trends For 2021Get Ready For What's New In Insurance Technology Trends For 2021
Get Ready For What's New In Insurance Technology Trends For 2021Mindbowser Inc
 
10 top mobile app development trends to look out for in 2021
10 top mobile app development trends to look out for in 202110 top mobile app development trends to look out for in 2021
10 top mobile app development trends to look out for in 2021Mindbowser Inc
 
How To Ensure Quality With Automation
How To Ensure Quality With AutomationHow To Ensure Quality With Automation
How To Ensure Quality With AutomationMindbowser Inc
 
15 Questions To Answer Before Building Your Website
15 Questions To Answer Before Building Your Website15 Questions To Answer Before Building Your Website
15 Questions To Answer Before Building Your WebsiteMindbowser Inc
 
10 growth strategies for a telehealth platform
10 growth strategies for a telehealth platform10 growth strategies for a telehealth platform
10 growth strategies for a telehealth platformMindbowser Inc
 

More from Mindbowser Inc (20)

Healthcare Technology Survey 2023
Healthcare Technology Survey 2023Healthcare Technology Survey 2023
Healthcare Technology Survey 2023
 
Top DevOps Trends And Statistics You Need To Know In 2023
Top DevOps Trends And Statistics You Need To Know In 2023Top DevOps Trends And Statistics You Need To Know In 2023
Top DevOps Trends And Statistics You Need To Know In 2023
 
How To Achieve Project Success With Your Outsourced Team?
How To Achieve Project Success With Your Outsourced Team?How To Achieve Project Success With Your Outsourced Team?
How To Achieve Project Success With Your Outsourced Team?
 
Data Science Consulting: From Idea To Deployment
Data Science Consulting: From Idea To DeploymentData Science Consulting: From Idea To Deployment
Data Science Consulting: From Idea To Deployment
 
Understanding The Difference Between RPO And Staff Augmentation
Understanding The Difference Between RPO And Staff AugmentationUnderstanding The Difference Between RPO And Staff Augmentation
Understanding The Difference Between RPO And Staff Augmentation
 
Top 5 Benefits Of IT Staff Augmentation For Modern Businesses
Top 5 Benefits Of IT Staff Augmentation For Modern BusinessesTop 5 Benefits Of IT Staff Augmentation For Modern Businesses
Top 5 Benefits Of IT Staff Augmentation For Modern Businesses
 
How To Select The Right Software Architecture For Your Healthcare Product?
How To Select The Right Software Architecture For Your Healthcare Product?How To Select The Right Software Architecture For Your Healthcare Product?
How To Select The Right Software Architecture For Your Healthcare Product?
 
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!Agile Scrum Mastery: Learn How To Bring Complex Projects To life!
Agile Scrum Mastery: Learn How To Bring Complex Projects To life!
 
A Guide To Minimum Viable Architecture Points For Any Startup
A Guide To Minimum Viable Architecture Points For Any StartupA Guide To Minimum Viable Architecture Points For Any Startup
A Guide To Minimum Viable Architecture Points For Any Startup
 
Benefits and challenges of ehr
Benefits and challenges of ehrBenefits and challenges of ehr
Benefits and challenges of ehr
 
What To Choose Between - Native App And Hybrid Mobile App
What To Choose Between - Native App And Hybrid Mobile AppWhat To Choose Between - Native App And Hybrid Mobile App
What To Choose Between - Native App And Hybrid Mobile App
 
7 Secret Reasons To Choose An Outsourced Agency?
7 Secret Reasons To Choose An Outsourced Agency?7 Secret Reasons To Choose An Outsourced Agency?
7 Secret Reasons To Choose An Outsourced Agency?
 
How We Thrill Customers?
How We Thrill Customers?How We Thrill Customers?
How We Thrill Customers?
 
Benefits and Challenges of EHR
Benefits and Challenges of EHRBenefits and Challenges of EHR
Benefits and Challenges of EHR
 
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...
20 Tools That Any Non Tech Founder Can Use To Manage Their Tech Product Devel...
 
Get Ready For What's New In Insurance Technology Trends For 2021
Get Ready For What's New In Insurance Technology Trends For 2021Get Ready For What's New In Insurance Technology Trends For 2021
Get Ready For What's New In Insurance Technology Trends For 2021
 
10 top mobile app development trends to look out for in 2021
10 top mobile app development trends to look out for in 202110 top mobile app development trends to look out for in 2021
10 top mobile app development trends to look out for in 2021
 
How To Ensure Quality With Automation
How To Ensure Quality With AutomationHow To Ensure Quality With Automation
How To Ensure Quality With Automation
 
15 Questions To Answer Before Building Your Website
15 Questions To Answer Before Building Your Website15 Questions To Answer Before Building Your Website
15 Questions To Answer Before Building Your Website
 
10 growth strategies for a telehealth platform
10 growth strategies for a telehealth platform10 growth strategies for a telehealth platform
10 growth strategies for a telehealth platform
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Golang workshop - Mindbowser

  • 2. Agenda ❖ Small talks and networking ❖ Introduction to Golang ❖ Why Golang ❖ Trends ❖ Golang Syntax & Hello World ❖ Implementing chatbot ❖ QA
  • 3. Introduction “Go will be the server language of the future.” — Tobias Lütke, CEO - Shopify
  • 4. Creators Created by Google Inc in 2009 by: ● Ken Thompson (B, C, UNIX, UTF-8), ● Rob Pike(UNIX, UTF-8) and ● Robert Griesmer (HotSpot, JVM) ● Procedural and imperative ● Object-oriented - Yes and No ● Compiled ● Syntax similar to C-family ● Concurrency inspired by CSP Nature
  • 5. Why they created Go? ● Frustration with existing language ● Had to choose either efficient compilation, efficient execution or ease of programming ● Dynamic typed (Python,JavaScript): easy +ve, safety -ve, efficiency -ve ● Compiled ( C ) are fast, but difficult to work and not safe ● Interpreted (Ruby) safe but slower ● Libraries and tools cannot address issues like lightweight type system, concurrency and garbage collection, rigid dependency specification and so on
  • 6. Go removes all obstacles Fast: fast compilation like interpreted language Safe: Strongly and statically typed and garbage collected Easy: Concise , easy to read Modern: Built in support for multi-core networked distributed applications
  • 7. Why learn or switch to Golang?
  • 8. Go has the cutest mascot
  • 9. GO GO GO... ● Overcoming hardware limitations ● Go’s Goroutines ● Go runs directly on underlying hardware ● Easy to maintain ● Best for microservices
  • 10. Overcoming hardware limitations ● 2000 - 1st P-4 processor with 1.4 GHz clock speed, ● 2004 - with 3.0GHz clock speed ● 2014 - Core i7 4790K with 4.0Ghz clock speed ● Manufacturers added multiple cores, hyper-threading technology, more cache ● Limitations on adding more h/w, cannot rely on hardware for performance ● Multi-core processors run multiple threads simultaneously - Go captures concurrency
  • 11.
  • 12.
  • 13. Go’s Goroutines ● Today's applications use multiple microservices which needs easy concurrency and scalability with increase no of cores ● Modern prog lang (like Java,Python etc) - 90’s single threaded environment ● They support multi-threading but problems with concurrent execution, threading-locking, race conditions and deadlocks ● Creating new thread in Java is not memory efficient, 1 thread = 1mb memory of heap size ● Golang created in 2009 under multiple core processors. 1 thread = 2Kb
  • 14. Go’s Goroutines ● Growable segmented stacks - use more memory only when needed. ● Faster startup time than threads ● Come with built-in primitives to communicate safely between themselves (channels) ● Goroutines and OS threads do not have 1:1 mapping. A single goroutine can run on multiple threads
  • 16. Go runs directly on underlying hardware Execution steps for VM based languages Execution steps for compiled languages
  • 17. Easy to maintain ● No classes: Go has only structs instead of classes ● Does not support inheritance: Make code easy to modify. In other languages like Java/Python, if the class ABC inherits class XYZ and you make some changes in class XYZ, then that may produce some side effects in other classes that inherit XYZ. By removing inheritance, Go makes it easy to understand the code also ● No constructors ● No assertions ● No generics ● No exceptions
  • 19. Best suitable for microservices ● Lightweight, very fast ● Fantastic support for concurrency, which is a powerful capability when running across several machines and cores ● Microservice framework like go-micro or go-kit ● Pluggable architecture based on RPC - gRPC
  • 20. Trends - Major Companies using Golang
  • 21. Trends - % of Stack Overflow question for Go Source: https://insights.stackoverflow.com/trends?tags=go
  • 22. Trends - Most used and wanted languages in 2017 Source: https://www.stackoverflowbusiness.com/hubfs/content/2017_Global_Developer_Hiring_Landscape. pdf
  • 23. Trends - Popularity Source: http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17/
  • 24. Trends - Programming language Hall of Fame Source: https://www.tiobe.com/tiobe-index/
  • 25.
  • 26. Syntax C Java Go Extension .c .java .go VM Needed Not needed JVM is there to convert java files to class files Not needed Compiler TurboC javac gc Program Execution Starts from main() function Starts from public static void main(String[ ] args) starts from func main() and should be in package main
  • 27. Syntax C Java Go Variable Declaration int a; float b; int a,b,c; Initialization int a=25; char c=’a’; int a; float b; a int var c string var a,b,c float Initialization var o,p int=34,65 k=45.67 (type of variable auto judged by compiler) Shorthand notation a:=30 (only inside function) Data Types bytes,short,int,long, double,float,char,void Primitive bytes,short,int,long ,double,float, boolean,char uint, int,float32,..., complex, byte,rune
  • 28. C Java Go Constant const int LEN=10 final int PI=3.14 const LEN int=10 Operators All operators like Arithmetic,Logical, Bitwise etc. are same All operators like Arithmetic,Logical, Bitwise etc. are same All operators like Arithmetic,Logical, Bitwise etc. are same Decision Making Statements (If else) if(i>5){ flag=true } else{ flag=false } if(i>5){ flag=true } else{ flag=false } if i>5{ flag=true }else{ flag=false } Syntax
  • 29. C Java Go Switch Case switch(i){ case 1: …… break; . . default:..... break ; } switch(i){ case 1: …… break; . . default:..... break ; } Expression switch switch marks{ case 90: grade==’A’ case 50,60,70:grade==’C . default: fmt.Println(“Invalid”) } Type switch var x interface{} switch x.(type){ case int: fmt.Println(“x is int”) default: fmt.Println(“I don’t know”) } Syntax
  • 30. C Java Go For loop for(i=1;i<5;i++){ ……... } for(i=1;i<5;i++){ ………….. } for i:=0;i<5;i++{ ……….. } for key,val:=range numbers{ ………….. } While Loop while(i<10){ i++; } while(i<10){ i++; } for sum<100{ sum+=sum } Syntax
  • 31. C Java Go Function Declaration int sum(int,int) int sum(int x,int y){ …………… return } Calling int add; add=sum(10,20) -Supports pass by value and reference Define method public int sum(int a,int b){ ………….. return } -Only pass by value func sum(no int) (int){ …… return .. } -Both pass by value and reference Function Overloading No Yes No Syntax
  • 32. C Java Go Variadic Functions No printMax(10,20,30) public static void printMax(double… numbers){ ……... } func sum(num ...int) int{ ….. …. } Ex. Println() is implemented in “fmt” package func Println(a ...interface{})(n int,err error) String char greet[6]={ ‘h’,’e’,’l’,’l’,’o’,’0’ } String s=new String(“Hello”) var greeting=”Hello” Syntax
  • 33. C Java Go String Functions strcpy(str1, str2) strcat(str1,str2) strlen(s1)............ str.length() str.concat(str2) str.compareTo(str2 ) String is made up of runes. Rune is UTF Format (A- ’65’,a-’97’) len(str) strings.join(str1,str 2) Arrays Fixed size data structure Declaration int array[10]; Accessing Elements int value=array[10] Declaration int[ ] numbers Creation numbers=new int[10] Declaration var number [10]int Initialization Var bal=[10] int{...............} Syntax
  • 34. C Java Go Slice There is no growable data structure java.util.Collection package provides dynamic growable array. E.g List,Set,Map etc Growable data structure Declaration var numbers []int Creation numbers=make([ ]int,5,5) 5 len, 5 is capacity append(),copy() Default value - nil Map There is no map data structure in C Key, Value pair Map m=new HashMap() Map[key] value Default value is nil Syntax
  • 35. C Java Go Map - m.put(“Zero”,1) put( ) get( ) ForEach to iterate over collection and array var dictionary=map [string] int dictionary[“Zero”]=1 Create using make var dict=make(map [string] int) Range -> to iterate over slice,map for key,val:=range values { ……... } Syntax
  • 36. C Java Go Struct / Class Collection of fields and methods struct book{ int id; char name[50]; char author[50]; }book; //Access members struct book book1; strcpy(book1.id,400) Java does not have struct but have class class Books{ int id; String name; String author; void display(){ …………... } } Books b=new Book(); b.name=”Vision” Go have struct to hold data in variables. type struct Book{ id int; name string; } func(book3 *Book) display() { ………….. } book1:=new(Book) var book2 Book; book2.name=”Go” Syntax
  • 37. C Java Go Embedding It is like inheritance in Java class A { …. } Class B extends A { ... } type Person struct{ Name string } func (per *Person) speak(){ …….. } type Mobile struct{ Person Model String } Mob:=new(Mobile) mob.Person.speak( ) Syntax
  • 38. C Java Go Pointer Direct address of memory location int *a a=&b; NULL pointer Always assign null value to pointer variable when you don’t know exact address to assign int *a=NULL; Java does not support pointer var a *int var fp *float32 a=&p NIL pointer var *p int=nil Syntax
  • 39. C Java Go Interface C does not have interface concept -Collection of only abstract methods (from java 8 it supports static methods also) -Classes implements interface public interface Animal{ public void eat(); public void sleep(); } public class Monkey extends Animal{ ……….. } -Provides method signatures type Shape interface { area() float64 } type square struct{ side float64 } func(sq Square)area( ) float64 { return sq.side*sq.side } Same method signature is implemented Syntax
  • 40. C Java Go Go has empty interface which is like object class in java. An empty interface can hold any type of value. fmt.Println(a ...interface{ }) Type Casting Convert variable from one to another data type (type) expression int sum=5,count=2; Double d=(double) sum/count Widening byte->short->int->float-> long->double float=10 Narrowing double->float->long->int- >short->byte int a=(float)10.40 var i int=10 var f float64=6.44 fmt.Println(float64(i)) fmt.Println(int(f)) Syntax
  • 41. C Java Go Error Handling -No direct support for error handling But it returns error no. perror() and strerror() used to display text message associated with error no int dividend=20; int divisor=0; int quotient; if(divisor==0){ fprintf(stderr,”Divide by zero”); exit(-1); } Exception Handling -Exception is problem arises during program execution. Checked/Unchecked Ex. try{ …… } catch(Exception ex){ …….. } finally{ …….. } No try/catch mechanism. Instead it is having defer,panic,recover concepts. -Provides error interface type error interface{ Error() string } Normally function returns error as last return value. Use errors.New() for specifying error msg. Syntax
  • 42. C Java Go Concurrency / Multithreading Doesn’t have support. Java have multithreading concept for simultaneous execution of different tasks at same time. We need to extends Thread class or Runnable interface and then implement run( ) and write your code start(),run(),join(),sleep(),... Here, we use goroutines for concurrent execution. To make function as goroutine just append go in front of your function. Two goroutines are communicating using channel concept Syntax
  • 43. Thank You! Drop us an email if you any doubts contact@mindbowser.com

Editor's Notes

  1. Procedural because procedures (functions) are stitched together to form a program. Imperative because functions are built out of statements which are generally phrased as imperative commands.
  2. Go takes good of both the worlds ( C family and Erlang). Easy to write concurrent and efficient to manage concurrency.
  3. https://github.com/golang/go/wiki/GoUsers
  4. https://insights.stackoverflow.com/trends?tags=go
  5. https://www.stackoverflowbusiness.com/hubfs/content/2017_Global_Developer_Hiring_Landscape.pdf
  6. http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17/
  7. https://www.tiobe.com/tiobe-index/