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

Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Ganesh Samarthyam
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the restgeorge.james
 
Go language presentation
Go language presentationGo language presentation
Go language presentationparamisoft
 
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
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golangBasil N G
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by GoogleUttam Gandhi
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventuremylittleadventure
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
Making the big data ecosystem work together with python apache arrow, spark,...
Making the big data ecosystem work together with python  apache arrow, spark,...Making the big data ecosystem work together with python  apache arrow, spark,...
Making the big data ecosystem work together with python apache arrow, spark,...Holden Karau
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Chicago Hadoop Users Group
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in osGenchiLu1
 
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)Holden Karau
 
Coding with golang
Coding with golangCoding with golang
Coding with golangHannahMoss14
 
An introduction to go programming language
An introduction to go programming languageAn introduction to go programming language
An introduction to go programming languageTechnology Parser
 
Google Go! language
Google Go! languageGoogle Go! language
Google Go! languageAndré Mayer
 
Semantic Integration with Apache Jena and Stanbol
Semantic Integration with Apache Jena and StanbolSemantic Integration with Apache Jena and Stanbol
Semantic Integration with Apache Jena and StanbolAll Things Open
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of GolangKartik Sura
 

What's hot (20)

Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
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
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Making the big data ecosystem work together with python apache arrow, spark,...
Making the big data ecosystem work together with python  apache arrow, spark,...Making the big data ecosystem work together with python  apache arrow, spark,...
Making the big data ecosystem work together with python apache arrow, spark,...
 
Go Lang
Go LangGo Lang
Go Lang
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
 
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)
Sharing (or stealing) the jewels of python with big data &amp; the jvm (1)
 
ApacheCon09: Avro
ApacheCon09: AvroApacheCon09: Avro
ApacheCon09: Avro
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 
An introduction to go programming language
An introduction to go programming languageAn introduction to go programming language
An introduction to go programming language
 
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
 
Semantic Integration with Apache Jena and Stanbol
Semantic Integration with Apache Jena and StanbolSemantic Integration with Apache Jena and Stanbol
Semantic Integration with Apache Jena and Stanbol
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
CBOR - The Better JSON
CBOR - The Better JSONCBOR - The Better JSON
CBOR - The Better JSON
 

Similar to Golang workshop - Mindbowser

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
 
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
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to GoSimon Hewitt
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Guillaume Laforge
 

Similar to Golang workshop - Mindbowser (20)

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
 
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
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 

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

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

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/