GOLANG INTRODUZIONE AL LINGUAGGIO
GOLANGINTRODUZIONE AL LINGUAGGIO
VOLANO
WIKIPEDIA
▸ “Go (often referred to as golang) is a programming
language created at Google[12] in 2009 by Robert
Griesemer, Rob Pike, and Ken Thompson."
INTRODUCTION
ABSTRACT
▸Late 2012
▸Solve
▸Multicore processor
▸Networking system
▸Massive computation cluster
▸Web programming
▸Built-in
▸Concurrency
▸Garbage collection
▸Dependency management
▸Testing
PAIN IN GOOGLE
PAINS
▸Slow build
▸Uncontrolled dependencies
▸Different subset of language
▸Poor program understanding
▸Difficulty of writing automatic tools
PAIN IN GOOGLE
PAINS
▸Development
▸Slow
▸Clumsy
▸Go
▸Faster
▸ Improve
▸Scalability
▸Productivity
▸Designed for
▸Large scale software
GOLANG
FEATURES
▸Compiled
▸Garbage collected
▸Statically typed
▸Open source
▸Google uses public repository
▸BSD Licence
GOLANG
GOALS
▸Scalable
▸Familiar
▸Modern
GOLANG
DEPENDENCIES
▸Compile time
▸40x faster than C
▸Unused #include/import
▸Warning (C) - Error (Go)
GOLANG
PACKAGES
▸ Install
▸Go get github.com/foo/bar
▸Usare
▸ import “foo/bar”
▸ import alias “vendor/package”
GOLANG
PACKAGES
GOLANG
SYNTAX
▸Few keywords
▸Declaration
▸Explicit
▸ Idiomatic :=
▸Function
▸Name
▸Receiver
▸No defaults
GOLANG
NAMING
▸Public
▸private
▸Scope
▸Universe
▸God?
▸Package
▸File
▸Function
▸Block
GOLANG
SEMANTIC
▸C-Like
▸Changes
▸No pointer arithmetic
▸With some “accrocchio” se po’ fa!
▸No implicit numeric conversion
▸No type aliases
▸Some kind of alias were introduced in 1.8
▸More
▸Concurrency
▸Garbage collection
▸ Interface type
▸Reflection
GOLANG
CONCURRENCY
▸CSP
▸Communicating
▸Sequential
▸Process
▸A model of concurrency in which values are passed between
independent activities
GOLANG
BANNING …
▸Ternary operator
▸While
▸ Implicit conversion
▸ Inheritance
GOLANG
COMPOSITION NOT INHERITANCE
▸Allow methods in any type
▸No subclassing
▸ Interfaces
▸ Implicit
GOLANG
TOOLS
▸Go build
▸Go test
▸Go fmt -w filename
GOLANG
RESOURCES … ?
GOLANG
LINKS
▸https://www.cheatography.com/explore/search/?q=golang
▸https://github.com/sensorario/awesome-go
▸https://github.com/sensorario/go-design-patterns
▸https://gobyexample.com/
▸https://tour.golang.org/welcome/1
▸https://talks.golang.org/2012/splash.article
▸https://golang.org/
▸https://gophers.slack.com (#italy)
GOLANG
FRAMEWORKS … ?
GOLANG
FRAMEWORKS
GOLANG
CODE … ?
GOLANG
TESTINGFizz buzz is a group word
game for children to teach
them
about division.[1] Players
take turns to count
incrementally, replacing
any number divisible by
three with the word "fizz",
and any number divisible
by five with the word
"buzz".
GOLANG
GOLANG