SlideShare uma empresa Scribd logo
13 
December 
2014 
getting started with 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
Go 
Programming 
Language 
Abiola 
Ibrahim 
@abiosoB
13 
December 
2014 
AGENDA 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• My 
Go 
Story 
• IntroducGon 
to 
Go 
• Build 
our 
applicaGon 
• Go 
on 
App 
Engine 
• AdopGon 
of 
Go 
• Useful 
Links
13 
December 
2014 
My 
Go 
Story 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Interpreted 
Languages 
have 
slower 
runGmes 
and 
no 
compile 
Gme 
error 
checks. 
• I 
like 
Java 
but 
not 
the 
JVM 
overhead. 
• Building 
C++ 
is 
not 
as 
fun 
as 
desired. 
• Go 
is 
compiled, 
single 
binary 
(no 
dependencies) 
and 
builds 
very 
fast.
Real 
World 
Go 
talk 
-­‐ 
Andrew 
Gerrand, 
2011. 
13 
December 
2014 
Why 
Go 
? 
“ 
“Speed, 
reliability, 
or 
simplicity: 
pick 
two.” 
(some9mes 
just 
one). 
Can’t 
we 
do 
be@er? 
” 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
13 
December 
2014 
Scope 
of 
Talk 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Things 
this 
talk 
cannot 
help 
you 
do 
– Build 
Drones 
– Create 
Google.com 
killer 
– Replicate 
Facebook 
• Things 
this 
talk 
can 
help 
you 
do 
– Understand 
the 
core 
of 
Go 
– Start 
wriGng 
Go 
apps
INTRODUCTION 
TO 
GO 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
Go 
is 
staGcally 
typed, 
but 
type 
inference 
saves 
repeGGon. 
13 
December 
2014 
Simple 
Type 
System 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
Java/C/C++: 
int i = 1; 
Go: 
i := 1 // type int 
pi := 3.142 // type float64 
hello := "Hello, GDays!" // type string 
add := func(x, y int) int { return x + y } 
//type func (x, y int)
Statements 
are 
terminated 
with 
semicolons 
but 
you 
don’t 
need 
to 
include 
it. 
var a int = 1 // valid line 
var b string = “GDays”; // also valid line 
13 
December 
2014 
Syntax 
and 
Structure 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
iota 
can 
come 
handy 
in 
constants 
const EVENT = “GDays” //value cannot change 
const ( 
ANDROID_SESSION = iota // 0 
GOLANG_SESSION // 1 
GIT_SESSION // 2 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
)
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
No 
brackets, 
just 
braces. 
if a < 0 { 
fmt.Printf(“%d is negative”, a) 
} 
for i := 0; i< 10; i++ { 
fmt.Println(“GDays is awesome”) 
}
No 
while, 
no 
do 
while, 
just 
for. 
for i < 10 { ... } //while loop in other languages 
for { ... } //infinite loop 
// range over arrays, slices and maps 
nums := [4]int{0, 1, 2, 3} 
for i, value := range nums { 
fmt.Println(“value at %d is %d”, i, value) 
} 
gdays := map[string]string{ “loc” : “Chams City”, ... } 
for key, value := range gdays { 
fmt.Println(“value at %s is %s”, key, value) 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
}
If 
statement 
supports 
iniGalizaGon. 
file, err := os.Open(“sample.txt”) 
if err == nil { 
fmt.Println(file.Name()) 
} 
This 
can 
be 
shortened 
to 
if file, err := os.Open(“sample.txt”); err == nil { 
fmt.Println(file.Name()) 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
}
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
MulGple 
return 
values. 
func Sqrt(float64 n) (float64, err) { 
if (n < 0){ 
return 0, errors.New(“Negative number”) 
} 
return math.Sqrt(n), nil 
}
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
MulGple 
assignments. 
a, b, c := 1, 2, 3 
func Reverse(str string) string { 
b := []byte(str) 
for i, j := 0, len(b)-1; i != j; i, j = i+1, j-1 { 
b[i], b[j] = b[j], b[i] 
} 
return string(b) 
}
var nums [4]int //array declaration 
nums := [4]int{0, 1, 2, 3} //declare and initialize 
n := nums[0:2] // slice of nums from index 0 to 1 
n := nums[:2] // same as above 
n := nums[2:] // from index 2 to max index 
n := nums[:] // slice of entire array 
nums[0] = 1 // assignment 
n[0] = 2 // assignment 
var copyOfNum = make([]int, 4) //slice allocation 
copy(copyOfNum, nums[:]) //copy nums into it 
13 
December 
2014 
Arrays 
and 
Slices 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
var gdays map[string]string //declaration 
gdays = make(map[string]string) //allocation 
//shorter declaration with allocation 
var gdays = make(map[string]string) 
gdays := make(map[string]string) 
gdays[“location”] = “Chams City” //assignment 
//declaration with values 
gdays := map[string]string { 
“location” : “Chams City” 
13 
December 
2014 
Maps 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
}
13 
December 
2014 
Structs 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
type Point struct { 
X int, 
Y int, 
Z int, 
} 
var p = &Point{0, 1, 3} 
//partial initialization 
var p = &Point{ 
X: 1, 
Z: 2, 
}
//void function without return value 
func SayHelloToMe(name string){ 
fmt.Printf(”Hello, %s”, name) 
} 
//function with return value 
func Multiply(x, y int) int { 
13 
December 
2014 
FuncGons 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
return x * y 
}
13 
December 
2014 
Methods 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
type Rectangle struct { 
X, Y int 
} 
func (r Rectangle) Area() int { 
return r.X * r.Y 
} 
r := Rectangle{4, 3} // type Rectangle 
r.Area() // == 12
Types 
and 
Methods 
You 
can 
define 
methods 
on 
any 
type. 
type MyInt int 
func (m MyInt) Square() int { 
i := int(m) 
return i * i 
} 
num := MyInt(4) 
num.Square() // == 16 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
13 
December 
2014 
Scoping 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Package 
level 
scope 
• No 
classes 
• A 
package 
can 
have 
mulGple 
source 
files 
• Package 
source 
files 
reside 
in 
same 
directory 
package main // sample package declaration
13 
December 
2014 
Visibility 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• No 
use 
of 
private 
or 
public 
keywords. 
• Visibility 
is 
defined 
by 
case 
//visible to other packages 
var Name string = “” 
func Hello(name string) string { 
return fmt.Printf(“Hello %s”, name) 
} 
//not visible to other packages 
var name string = “” 
func hello(name string) string { 
return fmt.Printf(“Hello %s”, name) 
}
13 
December 
2014 
Concurrency 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• GorouGnes 
are 
like 
threads 
but 
cheaper. 
MulGple 
per 
threads. 
• CommunicaGons 
between 
gorouGnes 
are 
done 
with 
channels 
done := make(chan bool) //create channel 
doSort := func(s []int) { 
sort(s) 
done <- true //inform channel goroutine is done 
}i 
:= pivot(s) 
go doSort(s[:i]) 
go doSort(s[i:]) 
<-done //wait for message on channel 
<-done //wait for message on channel
BUILDING 
OUR 
APPLICATION 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
Download 
Go 
installer 
for 
your 
pladorm 
at 
hep://golang.org/doc/install 
13 
December 
2014 
InstallaGon 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
13 
December 
2014 
Code 
Session 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Let 
us 
build 
a 
GDays 
Aeendance 
app. 
• Displays 
total 
number 
of 
aeendees 
• Ability 
to 
mark 
yourself 
as 
present 
Source 
code 
will 
be 
available 
aBer 
session 
at 
hep://github.com/abiosoB/gdays-­‐ae
GO 
ON 
APP 
ENGINE 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
13 
December 
2014 
Code 
Session 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Let 
us 
modify 
our 
app 
to 
suit 
App 
Engine 
– Use 
User 
service 
to 
uniquely 
idenGfy 
user 
– Use 
Data 
Store 
to 
persist 
number 
of 
aeendees 
Source 
code 
will 
be 
available 
aBer 
session 
at 
hep://github.com/abiosoB/gdays-­‐ae-­‐appengine
ADOPTION 
OF 
GO 
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim
13 
December 
2014 
Go 
in 
ProducGon 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Google 
• Canonical 
• DropBox 
• SoundCloud 
• Heroku 
• Digital 
Ocean 
• Docker 
And 
many 
more 
at 
hep://golang.org/wiki/GoUsers
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
USEFUL 
LINKS
13 
December 
2014 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• hep://golang.org/doc 
-­‐ 
official 
documentaGon 
• hep://tour.golang.org 
-­‐ 
interacGve 
tutorials 
• hep://gobyexample.com 
-­‐ 
tutorials 
• hep://gophercasts.io 
-­‐ 
screencasts 
• hep://golang.org/wiki/ArGcles 
-­‐ 
lots 
of 
helpful 
arGcles
13 
December 
2014 
Community 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim 
• Blog 
– hep://blog.golang.org 
• Google 
Group 
– heps://groups.google.com/d/forum/golang-­‐nuts 
• Gopher 
Academy 
– hep://gopheracademy.com 
• Me 
– hep://twieer.com/abiosoB 
– abiola89@gmail.com
13 
December 
2014 
THANK 
YOU 
Ge.ng 
Started 
with 
Go 
| 
Abiola 
Ibrahim

Mais conteúdo relacionado

Semelhante a Getting started with Go at GDays Nigeria 2014

An Introduction to Groovy for Java Developers
An Introduction to Groovy for Java DevelopersAn Introduction to Groovy for Java Developers
An Introduction to Groovy for Java Developers
Kostas Saidis
 
Go for Mobile Games
Go for Mobile GamesGo for Mobile Games
Go for Mobile Games
Takuya Ueda
 
go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptx
ArsalanMaqsood1
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
Sergey Pichkurov
 
eXo EC - Groovy Programming Language
eXo EC - Groovy Programming LanguageeXo EC - Groovy Programming Language
eXo EC - Groovy Programming Language
Hoat Le
 
JLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App DevelopmentJLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App Development
JLP Community
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
Eric Weimer
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
Codemotion
 
Me&g@home
Me&g@home Me&g@home
Me&g@home
Vytautas Dauksa
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
wesley chun
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
Andres Almiray
 
Influx/Days 2017 San Francisco | Dan Vanderkam
Influx/Days 2017 San Francisco | Dan VanderkamInflux/Days 2017 San Francisco | Dan Vanderkam
Influx/Days 2017 San Francisco | Dan Vanderkam
InfluxData
 
Golang introduction
Golang introductionGolang introduction
Golang introduction
DineshDinesh131
 
Pear Deck
Pear DeckPear Deck
Pear Deck
Artmiker Studios
 
Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)
Marcel Caraciolo
 
Groovy intro
Groovy introGroovy intro
BDD: Behind the Scenes
BDD: Behind the ScenesBDD: Behind the Scenes
BDD: Behind the Scenes
Nazarii Piontko
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introduction
Ginto Joseph
 
Golang preso
Golang presoGolang preso
Golang preso
Christopher Foresman
 
Eclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To GroovyEclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To Groovy
Andres Almiray
 

Semelhante a Getting started with Go at GDays Nigeria 2014 (20)

An Introduction to Groovy for Java Developers
An Introduction to Groovy for Java DevelopersAn Introduction to Groovy for Java Developers
An Introduction to Groovy for Java Developers
 
Go for Mobile Games
Go for Mobile GamesGo for Mobile Games
Go for Mobile Games
 
go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptx
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
eXo EC - Groovy Programming Language
eXo EC - Groovy Programming LanguageeXo EC - Groovy Programming Language
eXo EC - Groovy Programming Language
 
JLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App DevelopmentJLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App Development
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
 
Me&g@home
Me&g@home Me&g@home
Me&g@home
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
 
Influx/Days 2017 San Francisco | Dan Vanderkam
Influx/Days 2017 San Francisco | Dan VanderkamInflux/Days 2017 San Francisco | Dan Vanderkam
Influx/Days 2017 San Francisco | Dan Vanderkam
 
Golang introduction
Golang introductionGolang introduction
Golang introduction
 
Pear Deck
Pear DeckPear Deck
Pear Deck
 
Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)
 
Groovy intro
Groovy introGroovy intro
Groovy intro
 
BDD: Behind the Scenes
BDD: Behind the ScenesBDD: Behind the Scenes
BDD: Behind the Scenes
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introduction
 
Golang preso
Golang presoGolang preso
Golang preso
 
Eclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To GroovyEclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To Groovy
 

Último

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
Rakesh Kumar R
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
devvsandy
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
ssuserad3af4
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 

Último (20)

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 

Getting started with Go at GDays Nigeria 2014

  • 1. 13 December 2014 getting started with Ge.ng Started with Go | Abiola Ibrahim Go Programming Language Abiola Ibrahim @abiosoB
  • 2. 13 December 2014 AGENDA Ge.ng Started with Go | Abiola Ibrahim • My Go Story • IntroducGon to Go • Build our applicaGon • Go on App Engine • AdopGon of Go • Useful Links
  • 3. 13 December 2014 My Go Story Ge.ng Started with Go | Abiola Ibrahim • Interpreted Languages have slower runGmes and no compile Gme error checks. • I like Java but not the JVM overhead. • Building C++ is not as fun as desired. • Go is compiled, single binary (no dependencies) and builds very fast.
  • 4. Real World Go talk -­‐ Andrew Gerrand, 2011. 13 December 2014 Why Go ? “ “Speed, reliability, or simplicity: pick two.” (some9mes just one). Can’t we do be@er? ” Ge.ng Started with Go | Abiola Ibrahim
  • 5. 13 December 2014 Scope of Talk Ge.ng Started with Go | Abiola Ibrahim • Things this talk cannot help you do – Build Drones – Create Google.com killer – Replicate Facebook • Things this talk can help you do – Understand the core of Go – Start wriGng Go apps
  • 6. INTRODUCTION TO GO 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim
  • 7. Go is staGcally typed, but type inference saves repeGGon. 13 December 2014 Simple Type System Ge.ng Started with Go | Abiola Ibrahim Java/C/C++: int i = 1; Go: i := 1 // type int pi := 3.142 // type float64 hello := "Hello, GDays!" // type string add := func(x, y int) int { return x + y } //type func (x, y int)
  • 8. Statements are terminated with semicolons but you don’t need to include it. var a int = 1 // valid line var b string = “GDays”; // also valid line 13 December 2014 Syntax and Structure Ge.ng Started with Go | Abiola Ibrahim
  • 9. iota can come handy in constants const EVENT = “GDays” //value cannot change const ( ANDROID_SESSION = iota // 0 GOLANG_SESSION // 1 GIT_SESSION // 2 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim )
  • 10. 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim No brackets, just braces. if a < 0 { fmt.Printf(“%d is negative”, a) } for i := 0; i< 10; i++ { fmt.Println(“GDays is awesome”) }
  • 11. No while, no do while, just for. for i < 10 { ... } //while loop in other languages for { ... } //infinite loop // range over arrays, slices and maps nums := [4]int{0, 1, 2, 3} for i, value := range nums { fmt.Println(“value at %d is %d”, i, value) } gdays := map[string]string{ “loc” : “Chams City”, ... } for key, value := range gdays { fmt.Println(“value at %s is %s”, key, value) 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim }
  • 12. If statement supports iniGalizaGon. file, err := os.Open(“sample.txt”) if err == nil { fmt.Println(file.Name()) } This can be shortened to if file, err := os.Open(“sample.txt”); err == nil { fmt.Println(file.Name()) 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim }
  • 13. 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim MulGple return values. func Sqrt(float64 n) (float64, err) { if (n < 0){ return 0, errors.New(“Negative number”) } return math.Sqrt(n), nil }
  • 14. 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim MulGple assignments. a, b, c := 1, 2, 3 func Reverse(str string) string { b := []byte(str) for i, j := 0, len(b)-1; i != j; i, j = i+1, j-1 { b[i], b[j] = b[j], b[i] } return string(b) }
  • 15. var nums [4]int //array declaration nums := [4]int{0, 1, 2, 3} //declare and initialize n := nums[0:2] // slice of nums from index 0 to 1 n := nums[:2] // same as above n := nums[2:] // from index 2 to max index n := nums[:] // slice of entire array nums[0] = 1 // assignment n[0] = 2 // assignment var copyOfNum = make([]int, 4) //slice allocation copy(copyOfNum, nums[:]) //copy nums into it 13 December 2014 Arrays and Slices Ge.ng Started with Go | Abiola Ibrahim
  • 16. var gdays map[string]string //declaration gdays = make(map[string]string) //allocation //shorter declaration with allocation var gdays = make(map[string]string) gdays := make(map[string]string) gdays[“location”] = “Chams City” //assignment //declaration with values gdays := map[string]string { “location” : “Chams City” 13 December 2014 Maps Ge.ng Started with Go | Abiola Ibrahim }
  • 17. 13 December 2014 Structs Ge.ng Started with Go | Abiola Ibrahim type Point struct { X int, Y int, Z int, } var p = &Point{0, 1, 3} //partial initialization var p = &Point{ X: 1, Z: 2, }
  • 18. //void function without return value func SayHelloToMe(name string){ fmt.Printf(”Hello, %s”, name) } //function with return value func Multiply(x, y int) int { 13 December 2014 FuncGons Ge.ng Started with Go | Abiola Ibrahim return x * y }
  • 19. 13 December 2014 Methods Ge.ng Started with Go | Abiola Ibrahim type Rectangle struct { X, Y int } func (r Rectangle) Area() int { return r.X * r.Y } r := Rectangle{4, 3} // type Rectangle r.Area() // == 12
  • 20. Types and Methods You can define methods on any type. type MyInt int func (m MyInt) Square() int { i := int(m) return i * i } num := MyInt(4) num.Square() // == 16 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim
  • 21. 13 December 2014 Scoping Ge.ng Started with Go | Abiola Ibrahim • Package level scope • No classes • A package can have mulGple source files • Package source files reside in same directory package main // sample package declaration
  • 22. 13 December 2014 Visibility Ge.ng Started with Go | Abiola Ibrahim • No use of private or public keywords. • Visibility is defined by case //visible to other packages var Name string = “” func Hello(name string) string { return fmt.Printf(“Hello %s”, name) } //not visible to other packages var name string = “” func hello(name string) string { return fmt.Printf(“Hello %s”, name) }
  • 23. 13 December 2014 Concurrency Ge.ng Started with Go | Abiola Ibrahim • GorouGnes are like threads but cheaper. MulGple per threads. • CommunicaGons between gorouGnes are done with channels done := make(chan bool) //create channel doSort := func(s []int) { sort(s) done <- true //inform channel goroutine is done }i := pivot(s) go doSort(s[:i]) go doSort(s[i:]) <-done //wait for message on channel <-done //wait for message on channel
  • 24. BUILDING OUR APPLICATION 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim
  • 25. Download Go installer for your pladorm at hep://golang.org/doc/install 13 December 2014 InstallaGon Ge.ng Started with Go | Abiola Ibrahim
  • 26. 13 December 2014 Code Session Ge.ng Started with Go | Abiola Ibrahim • Let us build a GDays Aeendance app. • Displays total number of aeendees • Ability to mark yourself as present Source code will be available aBer session at hep://github.com/abiosoB/gdays-­‐ae
  • 27. GO ON APP ENGINE 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim
  • 28. 13 December 2014 Code Session Ge.ng Started with Go | Abiola Ibrahim • Let us modify our app to suit App Engine – Use User service to uniquely idenGfy user – Use Data Store to persist number of aeendees Source code will be available aBer session at hep://github.com/abiosoB/gdays-­‐ae-­‐appengine
  • 29. ADOPTION OF GO 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim
  • 30. 13 December 2014 Go in ProducGon Ge.ng Started with Go | Abiola Ibrahim • Google • Canonical • DropBox • SoundCloud • Heroku • Digital Ocean • Docker And many more at hep://golang.org/wiki/GoUsers
  • 31. 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim USEFUL LINKS
  • 32. 13 December 2014 Ge.ng Started with Go | Abiola Ibrahim • hep://golang.org/doc -­‐ official documentaGon • hep://tour.golang.org -­‐ interacGve tutorials • hep://gobyexample.com -­‐ tutorials • hep://gophercasts.io -­‐ screencasts • hep://golang.org/wiki/ArGcles -­‐ lots of helpful arGcles
  • 33. 13 December 2014 Community Ge.ng Started with Go | Abiola Ibrahim • Blog – hep://blog.golang.org • Google Group – heps://groups.google.com/d/forum/golang-­‐nuts • Gopher Academy – hep://gopheracademy.com • Me – hep://twieer.com/abiosoB – abiola89@gmail.com
  • 34. 13 December 2014 THANK YOU Ge.ng Started with Go | Abiola Ibrahim