SlideShare a Scribd company logo
1 of 31
SMITA VIJAYAKUMAR
Go Programming
INTRODUCTION TO
smita@exotel.in
Agenda
Modern Compute Environment
Focus: What Problem does it Solve?
History
How is it Achieved
For C Programmers - Major
Differences
Challenges in Modern
Compute Landscape
Environment
Multi-Core
Networked Systems
Computational Clusters
Web Programming Model
Thousands of Programmers
Same code base
Scale of Development
Legacy Languages
Language Feature Complex
Garbage Collection
Missing language support for Concurrency
Compilation Times
Dependency Management
Programmers digress from
the real task!
Crux:
Focus
“Go’s purpose is therefore not to do research
into programming language design; it is to
improve the working environment for its
designers and their coworkers.”
–Rob Pike
(Co-Designer of Go and Distinguished Engineer at Google)
History
History
Inception: 2007
Go 1.0 released in 2012
Rob Pike, Ken Thompson and Robert Griesemer
History
Binary = 2000 X C++ Source Bytes
Unused Library Includes
Conditional Includes
Extremely Slow Compilation
Even on Distributed Compilation System!
Desired Features
Light Weight
Increase Programmer Efficiency
Compiled Language
Concurrency
Garbage Collection
Statically Typed
How is it Achieved?
How
No unused import packages
Dependency graph is precise
No dependency cycles
Only exported data available
One object both exported and complete data
How
40X faster compilation times than C++!
Differences between
Go and C
Syntax
Import paths are URLs
Cleaner syntax
Syntax
//C
typedef struct A {
int a;
char b;
}
//Go
type A struct {
a int
b char
}
Syntax
/* C */
//Expression Syntax
int main(int argc, char *argv[])
// The Clockwise-Spiral Rule in C syntax parsing
int (*(*fp)(int (*)(int, int), int))(int, int)
/* Go */
// Type Syntax
func main(argc int, argv []string) int
//Left to right
f func(func(int,int) int, int) func(int, int) int
Syntax
//Go can also return multiple value from function
func ReadFile(r io.Reader) (num int, err error) {
...
}
...
n, err := ReadFile(r)
Syntax
package util
//Counter is visible when package is imported var Counter int
//name is not
var name string
//Seen
func ThisIsAlsoAvailable() error {
}
//not seen
func thisIsAPrivateFunction() error {
}
Scopes
Universe (language identifiers)
Package
File
Function
Block
Semantics
No pointer arithmetics
No implicit numeric conversions
Array bounds are always checked
types are not type aliases
type X int // X and int are distinct
Interface types
Reflection
Type switch
Concurrency
Go Routines
Channels - Communication Pipes
Concurrency
Light-weight threads of execution
Managed by Go Runtime
Run concurrently with other go routines
Example
Shared resource manager
Querier
DB Reader
etc...
Go Routines
Concurrency
package main
import “fmt”
func myPrinter(str string) {
fmt.Println(str)
}
func main() {
myPrinter(“one”)
go myPrinter(“maybetwo”)
go myPrinter(“maybethree”)
}
//Output
one
maybetwo
Maybethree
//Or
one
maybethree
maybetwo
//Or
one
...
Concurrency
Shared pipes connecting concurrent go routines
Channels
Concurrency
package main
import "fmt”
func main() {
messages := make(chan string)
// Send a value `channel <-`
go func() {
messages <- "ping"
}()
//continued
//continued
// Receive a value `<-channel`
msg := <-messages
fmt.Println(msg)
}
//Output
ping
GC
Easier for Programmer
No overhead of memory allocation and freeing
No explicit memory freeing
Interfaces
Set of methods
Methods on any type
Data types implementing all methods satisfy
Thank You!
SMITA VIJAYAKUMAR
smita@exotel.in

More Related Content

What's hot

What's hot (20)

Coding with golang
Coding with golangCoding with golang
Coding with golang
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
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
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
DSC IIITL Flutter Workshop
DSC IIITL Flutter WorkshopDSC IIITL Flutter Workshop
DSC IIITL Flutter Workshop
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Dart and Flutter Basics.pptx
Dart and Flutter Basics.pptxDart and Flutter Basics.pptx
Dart and Flutter Basics.pptx
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Local Apache NiFi Processor Debug
Local Apache NiFi Processor DebugLocal Apache NiFi Processor Debug
Local Apache NiFi Processor Debug
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Kotlin presentation
Kotlin presentation Kotlin presentation
Kotlin presentation
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 

Viewers also liked

猫にはわからないGit講座
猫にはわからないGit講座猫にはわからないGit講座
猫にはわからないGit講座
Yusei Yamanaka
 

Viewers also liked (8)

Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例
 
FPGAを用いたシリアル入力型VGA映像出力装置の設計と実装
FPGAを用いたシリアル入力型VGA映像出力装置の設計と実装FPGAを用いたシリアル入力型VGA映像出力装置の設計と実装
FPGAを用いたシリアル入力型VGA映像出力装置の設計と実装
 
FINAL FANTASY Record Keeperを支えたGolang
FINAL FANTASY Record Keeperを支えたGolangFINAL FANTASY Record Keeperを支えたGolang
FINAL FANTASY Record Keeperを支えたGolang
 
Database sql
Database sqlDatabase sql
Database sql
 
猫にはわからないGit講座
猫にはわからないGit講座猫にはわからないGit講座
猫にはわからないGit講座
 
【初心者向け】Go言語勉強会資料
 【初心者向け】Go言語勉強会資料 【初心者向け】Go言語勉強会資料
【初心者向け】Go言語勉強会資料
 
GoによるWebアプリ開発のキホン
GoによるWebアプリ開発のキホンGoによるWebアプリ開発のキホン
GoによるWebアプリ開発のキホン
 
LINE Ads PlatformのCTRを2倍にした開発手法
LINE Ads PlatformのCTRを2倍にした開発手法LINE Ads PlatformのCTRを2倍にした開発手法
LINE Ads PlatformのCTRを2倍にした開発手法
 

Similar to Introduction to Go programming

TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi
Spiffy
 

Similar to Introduction to Go programming (20)

TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija SiskoTrivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Golang
GolangGolang
Golang
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi.NET 4 Demystified - Sandeep Joshi
.NET 4 Demystified - Sandeep Joshi
 
The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84
 
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
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: 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
Lets Go - An introduction to Google's Go Programming Language
 
Ruby
RubyRuby
Ruby
 
Golang
GolangGolang
Golang
 
Welcome to Go
Welcome to GoWelcome to Go
Welcome to Go
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
 
Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009
 

More from Exotel

More from Exotel (14)

Exotel cost of moving to cloud
Exotel cost of moving to cloudExotel cost of moving to cloud
Exotel cost of moving to cloud
 
(Webinar) E-commerce delivery lifecycle - How to streamline communication
(Webinar) E-commerce delivery lifecycle - How to streamline communication(Webinar) E-commerce delivery lifecycle - How to streamline communication
(Webinar) E-commerce delivery lifecycle - How to streamline communication
 
Cloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile LogisticsCloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile Logistics
 
Setting A Culture of Technical Excellence
Setting A Culture of Technical ExcellenceSetting A Culture of Technical Excellence
Setting A Culture of Technical Excellence
 
Working at Exotel
Working at ExotelWorking at Exotel
Working at Exotel
 
Exotel For Last Mile Logistics
Exotel For Last Mile LogisticsExotel For Last Mile Logistics
Exotel For Last Mile Logistics
 
Using heka
Using hekaUsing heka
Using heka
 
#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context Library#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context Library
 
Exotel - Cloud telephony, Business phone system experts
Exotel - Cloud telephony, Business phone system expertsExotel - Cloud telephony, Business phone system experts
Exotel - Cloud telephony, Business phone system experts
 
E-Commerce Call Trends in India Report
E-Commerce Call Trends in India ReportE-Commerce Call Trends in India Report
E-Commerce Call Trends in India Report
 
To Sell Is Human: The Surprising Truth About Moving Others - a summary
To Sell Is Human: The Surprising Truth About Moving Others - a summaryTo Sell Is Human: The Surprising Truth About Moving Others - a summary
To Sell Is Human: The Surprising Truth About Moving Others - a summary
 
Exotel Culture Code
Exotel Culture CodeExotel Culture Code
Exotel Culture Code
 
Customer Development @ SLP Mumbai by Ruchir
Customer Development @ SLP Mumbai by RuchirCustomer Development @ SLP Mumbai by Ruchir
Customer Development @ SLP Mumbai by Ruchir
 
Nasscom Product Conclave - How to get your first 20 customers
Nasscom Product Conclave - How to get your first 20 customersNasscom Product Conclave - How to get your first 20 customers
Nasscom Product Conclave - How to get your first 20 customers
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

Introduction to Go programming