Ready, Set, GO!
Chad McCallum
ASP.NET MVP
iQmetrix Software
www.rtigger.com - @ChadEmm
An Introduction to the Go Programmi...
What is Go?
 A programming language!
 Initially created as a Google 20% project
 Released as an open source project on ...
The Software Development Landscape
 Born out of frustration with current languages
 There was a choice between efficient...
Enter Go
 Possible to compile a large program in a few seconds on a
single computer
 Provides a dependency model that av...
A Review of Go’s Features
 Simple language specification
 Compiles statically linked binaries without external
dependenc...
Simple Language Specification
 “Language specification simple enough to keep in a
programmer’s head”
 No type inheritanc...
Statically Linked Binaries
 Compiles to native machine code (x86 and ARM)
 All referenced libraries are compiled into th...
Remote Package Management
 Can import dependencies directly from remote
repositories, like GitHub, BitBucket, Google Code...
Concurrency Primitives
 goroutine – executes function on a lightweight process
 Similar to task pools in .NET, functions...
Why Choose Go?
 Why choose any language?
 Popularity – is there a decent amount of community support?
 Language-domain ...
Popularity
 Currently 36th on the TIOBE Index (March 2014)
 Used in a number of large projects at Google
 Youtube.com, ...
Language-Domain Match
 Targeted at systems programming
 Strengths in concurrency and deployment model
 Mostly used in s...
Libraries
 25,522 repositories on GitHub
 Application containers,
 web frameworks,
 websockets,
 continuous integrati...
Efficiency
 Natively compiled binaries
 Not interpreted
 No external dependencies
 No Intermediate Language, Common La...
Tools
 go build – compiles packages and dependencies into
executable
 go fix – rewrites programs that use old APIs to us...
IDEs
 LiteIDE – cross-platform IDE with support for Go and
Markdown
 Go plugin for Eclipse (Goclipse) – plugin for Eclip...
Ready, Set, GO!
 golang.org
 tour.golang.org
 play.golang.org
 godoc.org
 gobyexample.com
 goinggo.net
Chad McCallum...
Upcoming SlideShare
Loading in …5
×

Ready, set, go! An introduction to the Go programming language

1,202 views

Published on

A brief primer on Go - it's origins, its features, and why you may want to use it in your next software project

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,202
On SlideShare
0
From Embeds
0
Number of Embeds
207
Actions
Shares
0
Downloads
12
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • Do a demo compile of a go app hereGo build car.go
  • Download a package and show compiled resultGo get github.com/mitchellh/multistepBrowse to d:\go\pkg\...
  • Show code for channels.go, execute
  • http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • https://github.com/search?o=desc&q=language%3Ago&s=stars&type=Repositories
  • Show source code for .net and go. Execute, show result
  • Ready, set, go! An introduction to the Go programming language

    1. 1. Ready, Set, GO! Chad McCallum ASP.NET MVP iQmetrix Software www.rtigger.com - @ChadEmm An Introduction to the Go Programming Language
    2. 2. What is Go?  A programming language!  Initially created as a Google 20% project  Released as an open source project on November 10th, 2009  Go 1 (version 1) released on March 28th, 2012
    3. 3. The Software Development Landscape  Born out of frustration with current languages  There was a choice between efficient compilation, efficient execution, or ease of programming – most languages didn’t offer all three  Computers are faster, but software development isn’t  Dependency management is an unnecessarily large, complex part of software development  The complexity and awkwardness of type systems are losing out to languages like Python and JavaScript  Old languages haven’t caught up to modern affordances, like garbage collection and parallel computation  Multicore programming is scary and worrysome
    4. 4. Enter Go  Possible to compile a large program in a few seconds on a single computer  Provides a dependency model that avoids the overhead of traditional systems  The type system has no hierarchy, so no time is lost defining relationships  Fully garbage collected and provides primitives for concurrent execution and communication  By design, offers an approach to system software on multicore machines
    5. 5. A Review of Go’s Features  Simple language specification  Compiles statically linked binaries without external dependencies  Remote package management  Concurrency primitives
    6. 6. Simple Language Specification  “Language specification simple enough to keep in a programmer’s head”  No type inheritance (uses duck typing)  No method or operator overloading  No pointer math  No assertions  No generic programming
    7. 7. Statically Linked Binaries  Compiles to native machine code (x86 and ARM)  All referenced libraries are compiled into the same binary – no need to install libraries or framework on target machine  Because there’s no intermediate language, interpreter, or framework, applications start and run with minimal overhead
    8. 8. Remote Package Management  Can import dependencies directly from remote repositories, like GitHub, BitBucket, Google Code  go get github.com/ChadMcCallum/gotest  Uses the current version of the code in “master” (git) or “default” (mercurial)  Downloaded to local GOPATH folder
    9. 9. Concurrency Primitives  goroutine – executes function on a lightweight process  Similar to task pools in .NET, functions are executed on any available thread allocated by the application  Ensures routines don’t block each other  Allows developers to write synchronous code while being fully non- blocking  Channels provide a way to read and write between routines without managing synchronization  A routine that writes to a channel will wait until its message is received  A routine that reads from a channel will wait until it receives a message
    10. 10. Why Choose Go?  Why choose any language?  Popularity – is there a decent amount of community support?  Language-domain match – is the strengths of the language geared towards your problem domain?  Libraries – what packages already exist that you can reuse?  Efficiency – does the compiler and execution match up with your project’s requirements?  Tools – do the appropriate coding, debugging, tracing, and testing tools exist?
    11. 11. Popularity  Currently 36th on the TIOBE Index (March 2014)  Used in a number of large projects at Google  Youtube.com, dl.google.com, Google App Engine  Used in a number of production systems  Bit.ly, Torbit, pool.ntp.org, Canonical, CloudFlare, Conformal, Nov artis, BBC, SoundCloud, Moovweb, Heroku, Nokia  4472 questions in StackOverflow  16681 topics on the golang-nuts group
    12. 12. Language-Domain Match  Targeted at systems programming  Strengths in concurrency and deployment model  Mostly used in server and message-processing scenarios  Can, and does, support other scenarios  Web apps, games, graphical tools, education
    13. 13. Libraries  25,522 repositories on GitHub  Application containers,  web frameworks,  websockets,  continuous integration,  shared key-value stores,  shared cache,  distributed messaging,  maching imaging,  SQL engines,  service orchestration,  client code generation,  analytics,  autocomplete,  load testing,  http traffic capture,  static site generation,  geolocation,  PaaS
    14. 14. Efficiency  Natively compiled binaries  Not interpreted  No external dependencies  No Intermediate Language, Common Language Runtime, or Virtual Machine  Calculating 8 primes in parallel .NET Tasks – 12.6 seconds Goroutines – 5.99 seconds
    15. 15. Tools  go build – compiles packages and dependencies into executable  go fix – rewrites programs that use old APIs to use the newest version  go fmt – changes source code to match go standard  go get – download and install packages and dependencies  go install – compile and install packages and dependencies  go run – compile and run program  go test – run tests in packages
    16. 16. IDEs  LiteIDE – cross-platform IDE with support for Go and Markdown  Go plugin for Eclipse (Goclipse) – plugin for Eclipse  Zeus – Windows-only IDE with Go support  All three offer debugging, syntax highlighting, and code completion
    17. 17. Ready, Set, GO!  golang.org  tour.golang.org  play.golang.org  godoc.org  gobyexample.com  goinggo.net Chad McCallum @ChadEmm www.rtigger.com

    ×