SlideShare a Scribd company logo
10 Reasons to be
Excited About
Go
Dvir Volk, Chief Architect,
Everything.me
O HAI! I CAN HAS A GO?
What is Go
● New-ish programming language developed
at Google (and used there)
● Targeted for high performance servers
● Focuses on easing the life of the developer
● Addresses real pains - mainly from C++
● Object-Oriented-ish
● Statically Compiled
● Garbage Collected
● Strictly Typed
● Concurrency Oriented
Reason 1: The syntax
● Simple, Quick learning curve, little code to write.
● Few keywords - e.g.: do, while, for
● Multiple return values
● Public / private
● Maps, slices (vectors), queues as first class members
● Pointers - without arithmetic
● No macros
● No exceptions
● No templates
● No operator overloading
● No warnings!
The syntax: Hello World
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
The syntax: Variables, looping
package main
import "fmt"
func main() {
a, b := 1, 2
fmt.Printf("a + b: %dn", a + b)
for a < 100 {
a++
fmt.Println(a)
}
}
The syntax: Imports, casting
package main
import (
"fmt"
"math"
)
func main() {
for i := 0; i < 100; i++ {
fmt.Println(math.Pow(float64(i), 2))
}
}
The syntax: Funcs
package main
import (
"fmt"
// "math"
)
func square(i int) int {
return i*i
}
func main() {
for i := 0; i < 100; i++ {
fmt.Println(i, square(i))
}
}
The syntax: Structs & Methods
type User struct {
Name string
password string
}
// This is a method for User
func (u *User) Authenticate(name, password string) bool {
return u.Name == name && u.password == password
}
// Instead of constructors...
func NewUser(name, password string) *User {
return &User{ Name: name, password: password, }
}
// Instead of inheritence...
type Administrator struct {
User
email string
}
func (a *Administrator) SendMail(msg string) {
log.Println("Sending message to ", a.Name)
}
Reason 2: Compiler Speed
● The whole SDK and compiler compiled in 19 seconds.
● Standard library - a couple of seconds. For 370 KLOC.
● My own project, 5 KLOC - 0.186 seconds.
Why?
● Compiling imports only directly imported stuff.
● Compiler friendly syntax.
● The language is very small.
● Unused imports not allowed.
● Circular imports not allowed (no #IFDEF).
Reason 3: Execution Speed
● Go is FAST
● Slower usually than C++, not by a lot.
● More or less on par with Java
● about x10 to x100 faster than Python/Ruby
● (but let's not forget concurrency)
● Only gcc-go does machine code
optimizations
● Significant performance improvements
between versions.
Execution Speed: Go vs. C++
(Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
Execution Speed: Go vs. Java
(Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
Execution Speed: Go vs. Ruby
(Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
Reason 4: The Ecosystem
● Go Get - a pip/gem like installation system
● Compliant with Github / Google Code,
Bitbucket
● Any repo can be made compliant
● The repo url is also the namespace!
● Can be automated to run on compile time
● Excellent repo search engines
● Friendly, useful community
Importing a package: Example
package main
import (
"github.com/dvirsky/go-pylog/logging"
)
func main() {
logging.Info("All Your Base Are Belong to %s!", "us")
logging.Critical("And now with a stack trace")
}
Reason 5: Simple Conventions
● Lots of convention-over-configuration:
● all tests & benchmarks in *_test.go - just hit
go test
● func TestXXX(t *testing.T) {}
● func BenchmarkXXX(b *testing.B) {}
● func ExampleFoo() {}
● Excellent documentation system built-in
● Folders are packages, URLs for installed
● Public / private
Documentation & Examples: Input
Documentation & Examples: Output
Reason 6: Concurrency
● Goroutines and Channels are the heart of
Go
● Goroutines are microthreads with an internal
scheduler
● You can run 10Ks of goroutines easily
● No need for non-blocking IO. It is under the
hood!
● The usual pattern: One goroutine per server
connection
● Locks are available but not encouraged
Concurrency: Channels
● Channels are synchronized message
queues between goroutines.
● They are strictly typed first-class citizens.
● Delegate state through channels instead of
sharing it.
● Buffered channels for non blocking pushes.
● They can be iterated on.
Channels: Over-simplified example...
func producer(c chan string) {
for i := 0; i < 100; i++ {
c <- fmt.Sprintf("Message #%d", i)
}
close(c)
}
func main() {
c := make(chan string)
go producer(c)
for s := range c {
fmt.Println(s)
}
}
Channels: Slightly more complex #1
package main
import (
"fmt"
"runtime"
)
type result struct {
in int
out int
}
//worker getting numbers and sending back their sqaure
func squarer(in chan int, out chan result) {
for i := range in {
out <- result{i, i * i}
}
}
//take in the results and print them
func aggregator(res chan result) {
for s := range res {
fmt.Println(s)
}
}
// TO BE CONTINUED ON NEXT SLIDE ------>
Channels: Slightly more complex #2
func main() {
//utilize all CPUs
runtime.GOMAXPROCS(runtime.NumCPU())
//create the channels
inChan := make(chan int)
outChan := make(chan result)
//fire up the workers
for i := 0; i < 10; i++ {
go squarer(inChan, outChan)
}
//aggregate results
go aggregator(outChan)
//push the input
for i := 0; i < 1000; i++ {
inChan <- i
}
//there are prettier ways of blocking here... :)
var input string
fmt.Scanln(&input)
}
Reason 7: The standard library
● Excellent, rich standard library
● More like Python's than C++'s
● Very well documented
● Great source for idiomatic code
● Excellent serialization
Reason 7: The standard library
● The "Batteries" include:
○ Robust HTTP Web Server + template library
○ Compression, encryption, JSON / XML / CSV
○ Profiling, debugging, source parsing
○ Reflection library
○ Image manipulation
○ Plus the usual suspects
○ No GUI Toolkit :)
The standard library: A Web Server
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!" , r.URL.Path[1:])
}
func main() {
http.HandleFunc( "/", handler)
http.ListenAndServe( ":8080", nil)
}
Reason 8: C is never too far
● CGo is part of the standard library
● Makes binding C libraries trivial
● You can also trivially call Go code from C
● BTW: A JVM based Go exists ;)
package rand
/*
#include <stdlib.h>
*/
import "C"
func Random() int {
return int(C.rand())
}
func Seed(i int) {
C.srand(C. uint(i))
}
Reason 9: Implicit Interfaces
● Implementing an interface simply means you
implement it, no declaration needed.
● Example: any struct that has a method
String() string can be used for "%s" fmt
● You can mix and match interfaces as you go
● The empty interface, interface{} is super
useful.
● Interfaces can be safely cast into structs, or
called directly.
Reason 10: Procrastination It's Fun!
● Go is fun to work on and read about
● Beware: productive procrastination :)
● "Code is compiling" is no longer valid!
● Thank God we have a new excuse
Before we get too excited
● Lack of complete, real IDE
● Debugging: GDB Works great - but no real
frontend
● No dynamic linking/loading
● Implicit interfaces are cool but can be
confusing
● No exceptions - a matter of taste.
Wanna write some Go code?
We're hiring! :)
We're introducing Go to our backend and data
crunching stack, where C++ used to roam, or
where Go could kick Python's ass.
Email jobs@everything.me
A Few Good Resources
● The official website:
http://golang.org/
● Excellent introductory book:
http://www.golang-book.com/
● GoDoc: Package search
http://godoc.org/
● Migrating from Python to Go:
http://blog.repustate.com/migrating-code-from-python-
to-golang-what-you-need-to-know/2013/04/23/

More Related Content

What's hot

Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
Kartik Sura
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
sangam biradar
 
Introduction to Go programming language
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming language
Slawomir Dorzak
 
GO programming language
GO programming languageGO programming language
GO programming language
tung vu
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
paramisoft
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
Tzar Umang
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
Ishin Vin
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
Sveta Bozhko
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
GenchiLu1
 
Go Language Hands-on Workshop Material
Go Language Hands-on Workshop MaterialGo Language Hands-on Workshop Material
Go Language Hands-on Workshop Material
Romin Irani
 
How to write a well-behaved Python command line application
How to write a well-behaved Python command line applicationHow to write a well-behaved Python command line application
How to write a well-behaved Python command line application
gjcross
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golang
Yoni Davidson
 
Golang for OO Programmers
Golang for OO ProgrammersGolang for OO Programmers
Golang for OO Programmers
khalid Nowaf Almutiri
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
尚文 曾
 
Beginning python programming
Beginning python programmingBeginning python programming
Beginning python programming
kanteshraj
 
Golang concurrency design
Golang concurrency designGolang concurrency design
Golang concurrency design
Hyejong
 
Infecting Python Bytecode
Infecting Python BytecodeInfecting Python Bytecode
Infecting Python Bytecode
Iftach Ian Amit
 
Bind Python and C @ COSCUP 2015
Bind Python and C @ COSCUP 2015Bind Python and C @ COSCUP 2015
Bind Python and C @ COSCUP 2015
Jian-Hong Pan
 
Dependency management in golang
Dependency management in golangDependency management in golang
Dependency management in golang
Ramit Surana
 

What's hot (20)

Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
 
Introduction to Go programming language
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming language
 
GO programming language
GO programming languageGO programming language
GO programming language
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
 
Go Language Hands-on Workshop Material
Go Language Hands-on Workshop MaterialGo Language Hands-on Workshop Material
Go Language Hands-on Workshop Material
 
How to write a well-behaved Python command line application
How to write a well-behaved Python command line applicationHow to write a well-behaved Python command line application
How to write a well-behaved Python command line application
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golang
 
Golang for OO Programmers
Golang for OO ProgrammersGolang for OO Programmers
Golang for OO Programmers
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
 
Beginning python programming
Beginning python programmingBeginning python programming
Beginning python programming
 
Golang concurrency design
Golang concurrency designGolang concurrency design
Golang concurrency design
 
Infecting Python Bytecode
Infecting Python BytecodeInfecting Python Bytecode
Infecting Python Bytecode
 
Bind Python and C @ COSCUP 2015
Bind Python and C @ COSCUP 2015Bind Python and C @ COSCUP 2015
Bind Python and C @ COSCUP 2015
 
Dependency management in golang
Dependency management in golangDependency management in golang
Dependency management in golang
 

Viewers also liked

Golang
GolangGolang
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
André Mayer
 
An introduction to go programming language
An introduction to go programming languageAn introduction to go programming language
An introduction to go programming language
Technology Parser
 
Go lang
Go langGo lang
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
Dvir Volk
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Go: Beyond the Basics
Go: Beyond the BasicsGo: Beyond the Basics
Go: Beyond the Basics
Joey Gibson
 
Tales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe runningTales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe running
Dvir Volk
 
CloudEndure Technology Introduction For Partners
CloudEndure Technology Introduction For PartnersCloudEndure Technology Introduction For Partners
CloudEndure Technology Introduction For Partners
The Rudder Group
 
Let's Go (golang)
Let's Go (golang)Let's Go (golang)
Let's Go (golang)
상욱 송
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and Docker
Paolo latella
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of us
Jérôme Petazzoni
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
Jérôme Petazzoni
 
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Jérôme Petazzoni
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
Dvir Volk
 
Redis data modeling examples
Redis data modeling examplesRedis data modeling examples
Redis data modeling examples
Terry Cho
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
Itamar Haber
 
A microservice architecture based on golang
A microservice architecture based on golangA microservice architecture based on golang
A microservice architecture based on golang
Gianfranco Reppucci
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux ContainerBalaji Rajan
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redisDvir Volk
 

Viewers also liked (20)

Golang
GolangGolang
Golang
 
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
 
An introduction to go programming language
An introduction to go programming languageAn introduction to go programming language
An introduction to go programming language
 
Go lang
Go langGo lang
Go lang
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Go: Beyond the Basics
Go: Beyond the BasicsGo: Beyond the Basics
Go: Beyond the Basics
 
Tales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe runningTales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe running
 
CloudEndure Technology Introduction For Partners
CloudEndure Technology Introduction For PartnersCloudEndure Technology Introduction For Partners
CloudEndure Technology Introduction For Partners
 
Let's Go (golang)
Let's Go (golang)Let's Go (golang)
Let's Go (golang)
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and Docker
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of us
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
 
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
 
Redis data modeling examples
Redis data modeling examplesRedis data modeling examples
Redis data modeling examples
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
 
A microservice architecture based on golang
A microservice architecture based on golangA microservice architecture based on golang
A microservice architecture based on golang
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 

Similar to 10 reasons to be excited about go

Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io
 
Go. why it goes v2
Go. why it goes v2Go. why it goes v2
Go. why it goes v2
Sergey Pichkurov
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
maiktoepfer
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
Laszlo Csontos
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
Sergey Pichkurov
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
Victor S. Recio
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Hidden Dragons of CGO
Hidden Dragons of CGOHidden Dragons of CGO
Hidden Dragons of CGO
All Things Open
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
Basil N G
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
Amos Wenger
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Go
dreamwidth
 
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
Alessandro Sanino
 
Comparing C and Go
Comparing C and GoComparing C and Go
Comparing C and Go
Marcin Pasinski
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
Phil Eaton
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
Amr Hassan
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
borderj
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
Rodolfo Carvalho
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
GlobalLogic Ukraine
 

Similar to 10 reasons to be excited about go (20)

Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
Go. why it goes v2
Go. why it goes v2Go. why it goes v2
Go. why it goes v2
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Hidden Dragons of CGO
Hidden Dragons of CGOHidden Dragons of CGO
Hidden Dragons of CGO
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Go
 
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
 
Comparing C and Go
Comparing C and GoComparing C and Go
Comparing C and Go
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
C Lecture
C LectureC Lecture
C Lecture
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 

10 reasons to be excited about go

  • 1. 10 Reasons to be Excited About Go Dvir Volk, Chief Architect, Everything.me
  • 2. O HAI! I CAN HAS A GO?
  • 3. What is Go ● New-ish programming language developed at Google (and used there) ● Targeted for high performance servers ● Focuses on easing the life of the developer ● Addresses real pains - mainly from C++ ● Object-Oriented-ish ● Statically Compiled ● Garbage Collected ● Strictly Typed ● Concurrency Oriented
  • 4. Reason 1: The syntax ● Simple, Quick learning curve, little code to write. ● Few keywords - e.g.: do, while, for ● Multiple return values ● Public / private ● Maps, slices (vectors), queues as first class members ● Pointers - without arithmetic ● No macros ● No exceptions ● No templates ● No operator overloading ● No warnings!
  • 5. The syntax: Hello World package main import "fmt" func main() { fmt.Println("Hello World!") }
  • 6. The syntax: Variables, looping package main import "fmt" func main() { a, b := 1, 2 fmt.Printf("a + b: %dn", a + b) for a < 100 { a++ fmt.Println(a) } }
  • 7. The syntax: Imports, casting package main import ( "fmt" "math" ) func main() { for i := 0; i < 100; i++ { fmt.Println(math.Pow(float64(i), 2)) } }
  • 8. The syntax: Funcs package main import ( "fmt" // "math" ) func square(i int) int { return i*i } func main() { for i := 0; i < 100; i++ { fmt.Println(i, square(i)) } }
  • 9. The syntax: Structs & Methods type User struct { Name string password string } // This is a method for User func (u *User) Authenticate(name, password string) bool { return u.Name == name && u.password == password } // Instead of constructors... func NewUser(name, password string) *User { return &User{ Name: name, password: password, } } // Instead of inheritence... type Administrator struct { User email string } func (a *Administrator) SendMail(msg string) { log.Println("Sending message to ", a.Name) }
  • 10. Reason 2: Compiler Speed ● The whole SDK and compiler compiled in 19 seconds. ● Standard library - a couple of seconds. For 370 KLOC. ● My own project, 5 KLOC - 0.186 seconds. Why? ● Compiling imports only directly imported stuff. ● Compiler friendly syntax. ● The language is very small. ● Unused imports not allowed. ● Circular imports not allowed (no #IFDEF).
  • 11. Reason 3: Execution Speed ● Go is FAST ● Slower usually than C++, not by a lot. ● More or less on par with Java ● about x10 to x100 faster than Python/Ruby ● (but let's not forget concurrency) ● Only gcc-go does machine code optimizations ● Significant performance improvements between versions.
  • 12. Execution Speed: Go vs. C++ (Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
  • 13. Execution Speed: Go vs. Java (Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
  • 14. Execution Speed: Go vs. Ruby (Data: The benchmark game, http://benchmarksgame.alioth.debian.org/)
  • 15. Reason 4: The Ecosystem ● Go Get - a pip/gem like installation system ● Compliant with Github / Google Code, Bitbucket ● Any repo can be made compliant ● The repo url is also the namespace! ● Can be automated to run on compile time ● Excellent repo search engines ● Friendly, useful community
  • 16. Importing a package: Example package main import ( "github.com/dvirsky/go-pylog/logging" ) func main() { logging.Info("All Your Base Are Belong to %s!", "us") logging.Critical("And now with a stack trace") }
  • 17. Reason 5: Simple Conventions ● Lots of convention-over-configuration: ● all tests & benchmarks in *_test.go - just hit go test ● func TestXXX(t *testing.T) {} ● func BenchmarkXXX(b *testing.B) {} ● func ExampleFoo() {} ● Excellent documentation system built-in ● Folders are packages, URLs for installed ● Public / private
  • 20. Reason 6: Concurrency ● Goroutines and Channels are the heart of Go ● Goroutines are microthreads with an internal scheduler ● You can run 10Ks of goroutines easily ● No need for non-blocking IO. It is under the hood! ● The usual pattern: One goroutine per server connection ● Locks are available but not encouraged
  • 21. Concurrency: Channels ● Channels are synchronized message queues between goroutines. ● They are strictly typed first-class citizens. ● Delegate state through channels instead of sharing it. ● Buffered channels for non blocking pushes. ● They can be iterated on.
  • 22. Channels: Over-simplified example... func producer(c chan string) { for i := 0; i < 100; i++ { c <- fmt.Sprintf("Message #%d", i) } close(c) } func main() { c := make(chan string) go producer(c) for s := range c { fmt.Println(s) } }
  • 23. Channels: Slightly more complex #1 package main import ( "fmt" "runtime" ) type result struct { in int out int } //worker getting numbers and sending back their sqaure func squarer(in chan int, out chan result) { for i := range in { out <- result{i, i * i} } } //take in the results and print them func aggregator(res chan result) { for s := range res { fmt.Println(s) } } // TO BE CONTINUED ON NEXT SLIDE ------>
  • 24. Channels: Slightly more complex #2 func main() { //utilize all CPUs runtime.GOMAXPROCS(runtime.NumCPU()) //create the channels inChan := make(chan int) outChan := make(chan result) //fire up the workers for i := 0; i < 10; i++ { go squarer(inChan, outChan) } //aggregate results go aggregator(outChan) //push the input for i := 0; i < 1000; i++ { inChan <- i } //there are prettier ways of blocking here... :) var input string fmt.Scanln(&input) }
  • 25. Reason 7: The standard library ● Excellent, rich standard library ● More like Python's than C++'s ● Very well documented ● Great source for idiomatic code ● Excellent serialization
  • 26. Reason 7: The standard library ● The "Batteries" include: ○ Robust HTTP Web Server + template library ○ Compression, encryption, JSON / XML / CSV ○ Profiling, debugging, source parsing ○ Reflection library ○ Image manipulation ○ Plus the usual suspects ○ No GUI Toolkit :)
  • 27. The standard library: A Web Server package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!" , r.URL.Path[1:]) } func main() { http.HandleFunc( "/", handler) http.ListenAndServe( ":8080", nil) }
  • 28. Reason 8: C is never too far ● CGo is part of the standard library ● Makes binding C libraries trivial ● You can also trivially call Go code from C ● BTW: A JVM based Go exists ;) package rand /* #include <stdlib.h> */ import "C" func Random() int { return int(C.rand()) } func Seed(i int) { C.srand(C. uint(i)) }
  • 29. Reason 9: Implicit Interfaces ● Implementing an interface simply means you implement it, no declaration needed. ● Example: any struct that has a method String() string can be used for "%s" fmt ● You can mix and match interfaces as you go ● The empty interface, interface{} is super useful. ● Interfaces can be safely cast into structs, or called directly.
  • 30. Reason 10: Procrastination It's Fun! ● Go is fun to work on and read about ● Beware: productive procrastination :) ● "Code is compiling" is no longer valid! ● Thank God we have a new excuse
  • 31. Before we get too excited ● Lack of complete, real IDE ● Debugging: GDB Works great - but no real frontend ● No dynamic linking/loading ● Implicit interfaces are cool but can be confusing ● No exceptions - a matter of taste.
  • 32. Wanna write some Go code? We're hiring! :) We're introducing Go to our backend and data crunching stack, where C++ used to roam, or where Go could kick Python's ass. Email jobs@everything.me
  • 33. A Few Good Resources ● The official website: http://golang.org/ ● Excellent introductory book: http://www.golang-book.com/ ● GoDoc: Package search http://godoc.org/ ● Migrating from Python to Go: http://blog.repustate.com/migrating-code-from-python- to-golang-what-you-need-to-know/2013/04/23/