Go with the Flow
Nicola Larosa
Does Go really go with the flow?
Or does it rock the boat?
Go with the Flow Nicola Larosa 2/35
The Gopher
Renee French The Go Gopher
Go with the Flow Nicola Larosa 3/35
The name
Go
not "golang"
Go with the Flow Nicola Larosa 4/35
The designers
Robert Griesemer: HotSpot, V8
Rob Pike: Unix, Plan9, UTF-8
Ken Thompson: Unix, UTF-8
Go with the Flow Nicola Larosa 5/35
Where it all begun
Go with the Flow Nicola Larosa 6/35
Where it goes on
Go with the Flow Nicola Larosa 7/35
Why
Because of this
Go with the Flow Nicola Larosa 8/35
Also this
Go with the Flow Nicola Larosa 9/35
Some numbers
C: #include <stdio.h> reads 360 lines from 9 files
C++: #include <iostream> reads 25,326 lines from 131 files
Objective-C: #include <Cocoa/Cocoa.h> reads 112,047 lines
from 689 files
In Go, import "fmt" reads one file: 195 lines summarizing 6
dependent packages
Go with the Flow Nicola Larosa 10/35
C++ complexity
Go with the Flow Nicola Larosa 11/35
different language subsets
hard to read code
poorly documented code
hard to write automatic tools
cost of updates
What to do?
A new programming language of course!
They know how to make one, after all.
Go with the Flow Nicola Larosa 12/35
Go with the Flow Nicola Larosa 13/35
Simplicity
"Are you quite sure that all
those bells and whistles,
all those wonderful facilities
of your so-called powerful
programming languages,
belong to the solution set
rather than the problem set?"
- Edsger W. Dijkstra
Go with the Flow Nicola Larosa 14/35
Keywords, documentation
Language Version Keywords Pages
C K&R, 1988 32 238
C 11 2011 44 683
C++ 1990 48 480
C++ 14 2014 86 1330
Java SE 8 50 788
C# 4.0 77 538
Javascript ECMA-262 41 566
Python 3.5 33 141
Go 2012 25 98
Go with the Flow Nicola Larosa 15/35
Comparisons
Go with the Flow Nicola Larosa 16/35
Python, Ruby: slow (computer), fast (human)
JavaScript: slow-ish (computer), fast-ish (human)
Java: slow start-up, verbose
C: fast (computer), slow (human)
C++: fast (computer), even slower (human)
Comparison chart
Go with the Flow Nicola Larosa 17/35
Quote
"Go seems as perfectly in between C and Python:
it can be seen as a modernized C,
or like a super-optimized Python."
-- Enrico Franchi
Go with the Flow Nicola Larosa 18/35
A "mid-level" language
Go with the Flow Nicola Larosa 19/35
much of the simplicity of high-level languages like Python
much of the speed of low-level languages like C
little of the complexity of "side-level" beasts like C++ and Scala
Lineage
"In 1960, language experts from America and Europe
teamed up to create Algol 60.
In 1970, the Algol tree split into the C and the Pascal branch.
~40 years later, the two branches join again in Go.
Let's see if Go can enjoy an equally long run as its
predecessors!"
-- Robert Griesemer, GopherCon 2015
Go with the Flow Nicola Larosa 20/35
Timeline
Go with the Flow Nicola Larosa 21/35
2007-2008: design
2009/11: open source
2012/03: 1.0
2013/12: 1.2
2015/08: 1.5
2016/02: 1.6
Runtime
Go with the Flow Nicola Larosa 22/35
Goroutine scheduler
Garbage collection
Network polling
Goroutine mapping
Go with the Flow Nicola Larosa 23/35
Goroutine remapping
Go with the Flow Nicola Larosa 24/35
New 1.5 garbage collector
Go with the Flow Nicola Larosa 25/35
GC comparison
Go with the Flow Nicola Larosa 26/35
1.5 GC
Go with the Flow Nicola Larosa 27/35
In the wild #1
Go with the Flow Nicola Larosa 28/35
In the wild #2
Go with the Flow Nicola Larosa 29/35
In the wild #3
Go with the Flow Nicola Larosa 30/35
The website: golang.org
Go with the Flow Nicola Larosa 31/35
The book
2015, covers up to Go 1.5
gopl.io
github.com/adonovan/gopl.io
github.com/teknico/gopl.io
Go with the Flow Nicola Larosa 32/35
That guy
Go with the Flow Nicola Larosa 33/35
These slides
github.com/ajstarks/deck
bitbucket.org/teknico/codemotion-rome-2016
Go with the Flow Nicola Larosa 34/35
Questions!
Go with the Flow Nicola Larosa 35/35

Go With The Flow

  • 1.
    Go with theFlow Nicola Larosa
  • 2.
    Does Go reallygo with the flow? Or does it rock the boat? Go with the Flow Nicola Larosa 2/35
  • 3.
    The Gopher Renee FrenchThe Go Gopher Go with the Flow Nicola Larosa 3/35
  • 4.
    The name Go not "golang" Gowith the Flow Nicola Larosa 4/35
  • 5.
    The designers Robert Griesemer:HotSpot, V8 Rob Pike: Unix, Plan9, UTF-8 Ken Thompson: Unix, UTF-8 Go with the Flow Nicola Larosa 5/35
  • 6.
    Where it allbegun Go with the Flow Nicola Larosa 6/35
  • 7.
    Where it goeson Go with the Flow Nicola Larosa 7/35
  • 8.
    Why Because of this Gowith the Flow Nicola Larosa 8/35
  • 9.
    Also this Go withthe Flow Nicola Larosa 9/35
  • 10.
    Some numbers C: #include<stdio.h> reads 360 lines from 9 files C++: #include <iostream> reads 25,326 lines from 131 files Objective-C: #include <Cocoa/Cocoa.h> reads 112,047 lines from 689 files In Go, import "fmt" reads one file: 195 lines summarizing 6 dependent packages Go with the Flow Nicola Larosa 10/35
  • 11.
    C++ complexity Go withthe Flow Nicola Larosa 11/35 different language subsets hard to read code poorly documented code hard to write automatic tools cost of updates
  • 12.
    What to do? Anew programming language of course! They know how to make one, after all. Go with the Flow Nicola Larosa 12/35
  • 13.
    Go with theFlow Nicola Larosa 13/35
  • 14.
    Simplicity "Are you quitesure that all those bells and whistles, all those wonderful facilities of your so-called powerful programming languages, belong to the solution set rather than the problem set?" - Edsger W. Dijkstra Go with the Flow Nicola Larosa 14/35
  • 15.
    Keywords, documentation Language VersionKeywords Pages C K&R, 1988 32 238 C 11 2011 44 683 C++ 1990 48 480 C++ 14 2014 86 1330 Java SE 8 50 788 C# 4.0 77 538 Javascript ECMA-262 41 566 Python 3.5 33 141 Go 2012 25 98 Go with the Flow Nicola Larosa 15/35
  • 16.
    Comparisons Go with theFlow Nicola Larosa 16/35 Python, Ruby: slow (computer), fast (human) JavaScript: slow-ish (computer), fast-ish (human) Java: slow start-up, verbose C: fast (computer), slow (human) C++: fast (computer), even slower (human)
  • 17.
    Comparison chart Go withthe Flow Nicola Larosa 17/35
  • 18.
    Quote "Go seems asperfectly in between C and Python: it can be seen as a modernized C, or like a super-optimized Python." -- Enrico Franchi Go with the Flow Nicola Larosa 18/35
  • 19.
    A "mid-level" language Gowith the Flow Nicola Larosa 19/35 much of the simplicity of high-level languages like Python much of the speed of low-level languages like C little of the complexity of "side-level" beasts like C++ and Scala
  • 20.
    Lineage "In 1960, languageexperts from America and Europe teamed up to create Algol 60. In 1970, the Algol tree split into the C and the Pascal branch. ~40 years later, the two branches join again in Go. Let's see if Go can enjoy an equally long run as its predecessors!" -- Robert Griesemer, GopherCon 2015 Go with the Flow Nicola Larosa 20/35
  • 21.
    Timeline Go with theFlow Nicola Larosa 21/35 2007-2008: design 2009/11: open source 2012/03: 1.0 2013/12: 1.2 2015/08: 1.5 2016/02: 1.6
  • 22.
    Runtime Go with theFlow Nicola Larosa 22/35 Goroutine scheduler Garbage collection Network polling
  • 23.
    Goroutine mapping Go withthe Flow Nicola Larosa 23/35
  • 24.
    Goroutine remapping Go withthe Flow Nicola Larosa 24/35
  • 25.
    New 1.5 garbagecollector Go with the Flow Nicola Larosa 25/35
  • 26.
    GC comparison Go withthe Flow Nicola Larosa 26/35
  • 27.
    1.5 GC Go withthe Flow Nicola Larosa 27/35
  • 28.
    In the wild#1 Go with the Flow Nicola Larosa 28/35
  • 29.
    In the wild#2 Go with the Flow Nicola Larosa 29/35
  • 30.
    In the wild#3 Go with the Flow Nicola Larosa 30/35
  • 31.
    The website: golang.org Gowith the Flow Nicola Larosa 31/35
  • 32.
    The book 2015, coversup to Go 1.5 gopl.io github.com/adonovan/gopl.io github.com/teknico/gopl.io Go with the Flow Nicola Larosa 32/35
  • 33.
    That guy Go withthe Flow Nicola Larosa 33/35
  • 34.
  • 35.
    Questions! Go with theFlow Nicola Larosa 35/35