Slide 1

Slide 1 text

evolution of a gopher francesc

Slide 2

Slide 2 text

about me - Developer Advocate for the Google Cloud Platform - Developer Programs Engineer for the Go team since 2012 - Lover of all programming languages - Instructor at Google @francesc github.com/campoy

Slide 3

Slide 3 text

about this talk Inspired “evolution of a developer” by Raquel Velez (@rockbot)

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

1. the newcomer the phases of evolution

Slide 6

Slide 6 text

1. the newcomer 2. the explorer the phases of evolution

Slide 7

Slide 7 text

1. the newcomer 2. the explorer 3. the builder the phases of evolution

Slide 8

Slide 8 text

1. the newcomer 2. the explorer 3. the builder 4. the expert the phases of evolution

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

the newcomer First steps: - tutorials - workshops Concepts: - syntax - slices and maps - functions, types, and methods

Slide 12

Slide 12 text

create small programs, toy projects main resources: - go tour - go playground - documentation - golang-nuts/slack/irc playing around

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

- write some small projects - still gets lost - many new things to learn - but knows where to find help and ask questions the explorer

Slide 15

Slide 15 text

learning curve note: this is graphic is absolutely not scientific explorer

Slide 16

Slide 16 text

Go is awesome, I can do everything! ”let me migrate this framework to Go” But to improve something we have to understand it first. the peak of inflated expectations

Slide 17

Slide 17 text

inflated expectations lead to painful realizations

Slide 18

Slide 18 text

But I miss X feature from Y language! Use the language as is and have fun. The standard library is very useful. the trough of disillusionment

Slide 19

Slide 19 text

Try new things - go generate - Go on Android Fighting the disillusionment

Slide 20

Slide 20 text

- parsing with go/ast - generation with text/template github.com/campoy/jsonenums jsonenums

Slide 21

Slide 21 text

package painkiller //go:generate jsonenums -type=Pill type Pill int const ( Placebo Pill = iota Aspirin Ibuprofen Paracetamol Acetaminophen = Paracetamol )

Slide 22

Slide 22 text

var _PillValueToName = map[Pill]string{ Placebo: “Placebo”, Aspirin: “Aspirin”, ... } func (r Pill) MarshalJSON() ([]byte, error) { s, ok := _PillValueToName[r] if !ok { return nil, fmt.Errorf("invalid Pill: %d", r) } return json.Marshal(s) }

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Challenges and competitions gophergala.com golang-challenge.com

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Solve a problem you care about New problems lead to new questions And sometimes new solutions the builder

Slide 27

Slide 27 text

contribute to an existing project - Go - Docker - Kubernetes - Many other: github.com/golang/go/wiki/Projects

Slide 28

Slide 28 text

tooling things that matter when you build stuff - go get/build/install/run - go generate - govet - go test -race - gofmt, goimports, goreturns

Slide 29

Slide 29 text

Before goimports func main() { fmt.Println(“hello”) }

Slide 30

Slide 30 text

After goimports package main import “fmt” func main() { fmt.Println(“hello”) }

Slide 31

Slide 31 text

Before goreturns package foo func count() (int, error) { if err := check(); err != nil { return err } return n, nil }

Slide 32

Slide 32 text

After goreturns package foo func count() (int, error) { if err := check(); err != nil { return 0, err } return n, nil }

Slide 33

Slide 33 text

code reviews

Slide 34

Slide 34 text

Intent: - fix mistakes - uniformize code style - improve quality of software - improve developers’ skill code reviews

Slide 35

Slide 35 text

coding culture spreads via code reviews

Slide 36

Slide 36 text

Learning and teaching opportunity code reviews

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

the expert - specs - philosophy - recognition

Slide 39

Slide 39 text

Go is “just” a tool As any other programming language - it can be very advanced - or hard to master but - it is the means to an end

Slide 40

Slide 40 text

- Different points of view - Synergy between different languages - Idiomatic adaptation of idioms Why using just a tool?

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

share your knowledge: - write - talk - complain the advocate

Slide 43

Slide 43 text

go-meetups.appspot.com

Slide 44

Slide 44 text

Gophers of every level of experience - top down - help gophers learn - bottom up - make the community more welcoming the advocate

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

thanks @francesc