Google Go
Web Technology Talks Meeting - 24.8.2010
          Moritz Haarmann
It includes a http-server
     thats why it‘s a web-technology.
Moritz Haarmann
• GTUG/NA Founding Member
• Interests: Android, iPhone, Web and Open
  Technologies
• 25y, writing my Bachelor Thesis
  ( CompScience ), HdM Stuttgart
• @derwildemomo
Thinks to talk about
Thinks to talk about
Why Google decided to go. ( Speculation )
Thinks to talk about
Why Google decided to go. ( Speculation )




Go Basics
Thinks to talk about
Why Google decided to go. ( Speculation )




Go Basics      Cool Ideas
Thinks to talk about
Why Google decided to go. ( Speculation )




                               Get you
Go Basics      Cool Ideas
                                going
Why Go?
C is still second-most used
   but almost 40 years old and notoriously unsafe
Java is not always an option
        read: System programming
Python etc. also rock
Same problem: Though they are cool, they cannot be
             applied to any problem
38 years after the
 invention of C
No real Alternative
Go
Go Basics
The Basics
The Basics
• Compiled, no Bytecode/Interpreter
The Basics
• Compiled, no Bytecode/Interpreter
• Static Typing
The Basics
• Compiled, no Bytecode/Interpreter
• Static Typing
• Concurrent, Functional, Imperative
  Paradigms satisfied
The Basics
• Compiled, no Bytecode/Interpreter
• Static Typing
• Concurrent, Functional, Imperative
  Paradigms satisfied
• Clean design, familiar C-like Syntax
The Basics
• Compiled, no Bytecode/Interpreter
• Static Typing
• Concurrent, Functional, Imperative
  Paradigms satisfied
• Clean design, familiar C-like Syntax
• Garbage Collector: its problem is not
  yours.
Always ask!
Hello World
package main

import "fmt"

func main() {
    fmt.Println("Hello, World")
}
Functions
with super-cow-powers.
Simple Function
  func simpleFunction() {
      (...)
  }

  func caller() {
      simpleFunction()
  }
Better Functions
Better Functions
func Function(an int) (int) {
    return an + 1
}
Better Functions
func Function(an int) (int) {
    return an + 1
}



func Function(an int) (returnValue int, another int)
{
    returnValue = an + in
    another = returnValue * 5
    return
}
Better Functions
func Function(an int) (int) {
    return an + 1
}



func Function(an int) (returnValue int, another int)
{
    returnValue = an + in
    another = returnValue * 5
    return
}
a,_ = Function(1)
Functionals

func execFunc(aFunc func()) {
    aFunc()
}
Functionals
func execFunc(aFunc func()) {
    aFunc()
    var anotherF = func(){
        fmt.Println("Thats another function")
    }
    execFunc(anotherF)
}
Packages
  in a short
Packages
• Form the core organizational unit
• one package - one file
• entry point: Package main with function
  main
• Function visibility: First letter decides!
  ( func invisible() vs. func Visible() )
• many packages shipped for common tasks,
  e.g. http
Package Example
 package main

 import "fmt"

 func main() {
     fmt.Println("Hello, World")
 }
a parallel world
Sharing Memory
 information a a information a
   information information a
 information a a information a
   information information a
 information a a information a
   information information a
 information a a information a
   information information a
 information a a information a
   information information a
 information a a information a
   information information a
Sharing by
Communicating

   information a information b
   information b information b
   information b information b
   information b information a
   information a information a
   information a information a
Do not communicate by
sharing memory; instead, share
  memory by communicating
Goroutines & Channels
Goroutine
func showGo() {
    go func(){
        time.Sleep(20)
        fmt.Println("parallel.")
    }
}
Channels
Channels
• First-Class Value Object
Channels
• First-Class Value Object
• Typed, e.g. chan int is a channel transporting
  ints.
Channels
• First-Class Value Object
• Typed, e.g. chan int is a channel transporting
  ints.
• buffered, that is async, or unbuffered and
  therefore synchronous channel
Channels
• First-Class Value Object
• Typed, e.g. chan int is a channel transporting
  ints.
• buffered, that is async, or unbuffered and
  therefore synchronous channel
• Brainfuck ( for now ): channels of channels!
Sorting in background
      c := make(chan int)
      go func() {
          list.Sort()
          c <- 1
      }()
      doSomethingForAWhile()
      <-c
WTF?
WTF?

• Goroutines and Channels hide the
  complexity of threads, mutexes and other
  hard-to-master stuff effectively
WTF?

• Goroutines and Channels hide the
  complexity of threads, mutexes and other
  hard-to-master stuff effectively
• Race conditions, deadlocks etc are
  impossible.
WTF?

• Goroutines and Channels hide the
  complexity of threads, mutexes and other
  hard-to-master stuff effectively
• Race conditions, deadlocks etc are
  impossible.
• Another underlying thought model
A word on types
A word on types
• Known types are known ( int, unsigned )
A word on types
• Known types are known ( int, unsigned )
• First-Class UTF-8 Strings
A word on types
• Known types are known ( int, unsigned )
• First-Class UTF-8 Strings
• Arrays, Maps
A word on types
• Known types are known ( int, unsigned )
• First-Class UTF-8 Strings
• Arrays, Maps
• Custom Types
A word on types
• Known types are known ( int, unsigned )
• First-Class UTF-8 Strings
• Arrays, Maps
• Custom Types
• Arrays++: Slices
A word on types
• Known types are known ( int, unsigned )
• First-Class UTF-8 Strings
• Arrays, Maps
• Custom Types
• Arrays++: Slices
• Pointers but no arithmetic ( guess why )
Slices
Slices

• Type- and Boundsafe Array Wrappers, that
  can be easily generated and passed around
Slices

• Type- and Boundsafe Array Wrappers, that
  can be easily generated and passed around
• Reference to underlying data
Slices

• Type- and Boundsafe Array Wrappers, that
  can be easily generated and passed around
• Reference to underlying data
• Safe, fast and easy to use
Interfaces
Interfaces


• Duck Typing-Style
Interfaces


• Duck Typing-Style
• Quite Useful
A bit OO


• Functions operating on a type
...
type Momo struct {
    a int
    b int
}

func (m *Momo) wakeUp {
    m.shakeAlmostToDeath()
}

var m = new(Momo)
m.wakeUp()
Not discussed today
Not discussed today
• A lot
Not discussed today
• A lot
• Allocation, Memory Handling
Not discussed today
• A lot
• Allocation, Memory Handling
• Built-In gimmicks ( Do.once, init )
Not discussed today
• A lot
• Allocation, Memory Handling
• Built-In gimmicks ( Do.once, init )
• Error Handling
Not discussed today
• A lot
• Allocation, Memory Handling
• Built-In gimmicks ( Do.once, init )
• Error Handling
• The bitchy compiler
Not discussed today
• A lot
• Allocation, Memory Handling
• Built-In gimmicks ( Do.once, init )
• Error Handling
• The bitchy compiler
• Embedding
Questions?
http://tinyurl.com/gotalk2010
            und danke!

More Related Content

PPTX
Fundamentals of Python Programming
PDF
Teach your kids how to program with Python and the Raspberry Pi
PDF
Python basics_ part1
PDF
Python
PPTX
2016 bioinformatics i_python_part_1_wim_vancriekinge
PPTX
Introduction to python
PPTX
2016 02 23_biological_databases_part2
PPTX
Presentation on python
Fundamentals of Python Programming
Teach your kids how to program with Python and the Raspberry Pi
Python basics_ part1
Python
2016 bioinformatics i_python_part_1_wim_vancriekinge
Introduction to python
2016 02 23_biological_databases_part2
Presentation on python

What's hot (19)

PPTX
Introduction to Structure Programming with C++
ODP
Introduction to programming with python
PDF
What can Ruby learn from Python (and vice versa)?
PPTX
Python Tutorial Part 1
PPTX
Python basics
ODP
Python Presentation
PPTX
Class 27: Pythonic Objects
PPTX
Basic Python Programming: Part 01 and Part 02
PDF
Python cheat-sheet
PDF
Introduction to Programming in Go
PDF
Understand unicode & utf8 in perl (2)
PDF
Intro to Python Workshop San Diego, CA (January 19, 2013)
PDF
Zero to Hero - Introduction to Python3
PDF
MMBJ Shanzhai Culture
XLS
LoteríA Correcta
PDF
Jerry Shea Resume And Addendum 5 2 09
PDF
Washington Practitioners Significant Changes To Rpc 1.5
PPTX
Paulo Freire Pedagpogia 1
PPTX
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Introduction to Structure Programming with C++
Introduction to programming with python
What can Ruby learn from Python (and vice versa)?
Python Tutorial Part 1
Python basics
Python Presentation
Class 27: Pythonic Objects
Basic Python Programming: Part 01 and Part 02
Python cheat-sheet
Introduction to Programming in Go
Understand unicode & utf8 in perl (2)
Intro to Python Workshop San Diego, CA (January 19, 2013)
Zero to Hero - Introduction to Python3
MMBJ Shanzhai Culture
LoteríA Correcta
Jerry Shea Resume And Addendum 5 2 09
Washington Practitioners Significant Changes To Rpc 1.5
Paulo Freire Pedagpogia 1
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Ad

Viewers also liked (8)

PDF
Facebook Scaling Overview
PDF
Use open source and rapid prototyping to put magic in magical products in IoT
PPT
Marketing and Technology Go Hand-in Hand, But Where are They Going?
PDF
Memory Management in Android
PDF
Simple Web Design Case Study (Website Design Process Walkthrough)
PDF
Scheduling in Android
PDF
Android Things Internals
PDF
Die Android Plattform
Facebook Scaling Overview
Use open source and rapid prototyping to put magic in magical products in IoT
Marketing and Technology Go Hand-in Hand, But Where are They Going?
Memory Management in Android
Simple Web Design Case Study (Website Design Process Walkthrough)
Scheduling in Android
Android Things Internals
Die Android Plattform
Ad

Similar to Google Go Overview (20)

PDF
Inroduction to golang
PDF
Introduction to Go programming language
PPTX
Go. Why it goes
KEY
Beauty and Power of Go
ODP
Ready to go
PPTX
Should i Go there
PPTX
The GO Language : From Beginners to Gophers
PPTX
Lightning talk: Go
ODP
Introduction to Go for Java Developers
PDF
10 reasons to be excited about go
PDF
LCA2014 - Introduction to Go
PDF
golang_refcard.pdf
PPTX
Go fundamentals
PDF
Golang
PDF
Go Lang Tutorial
PPTX
Next Generation Language Go
PPTX
Introduction to go lang
PDF
2011 july-nyc-gtug-go
PPTX
Golang - Overview of Go (golang) Language
PDF
Go. why it goes v2
Inroduction to golang
Introduction to Go programming language
Go. Why it goes
Beauty and Power of Go
Ready to go
Should i Go there
The GO Language : From Beginners to Gophers
Lightning talk: Go
Introduction to Go for Java Developers
10 reasons to be excited about go
LCA2014 - Introduction to Go
golang_refcard.pdf
Go fundamentals
Golang
Go Lang Tutorial
Next Generation Language Go
Introduction to go lang
2011 july-nyc-gtug-go
Golang - Overview of Go (golang) Language
Go. why it goes v2

Recently uploaded (20)

PDF
Getting started with AI Agents and Multi-Agent Systems
PPT
What is a Computer? Input Devices /output devices
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Tartificialntelligence_presentation.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Developing a website for English-speaking practice to English as a foreign la...
DOCX
search engine optimization ppt fir known well about this
PDF
Five Habits of High-Impact Board Members
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Getting Started with Data Integration: FME Form 101
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
Architecture types and enterprise applications.pdf
PPTX
Modernising the Digital Integration Hub
PPTX
Chapter 5: Probability Theory and Statistics
Getting started with AI Agents and Multi-Agent Systems
What is a Computer? Input Devices /output devices
NewMind AI Weekly Chronicles – August ’25 Week III
Tartificialntelligence_presentation.pptx
A novel scalable deep ensemble learning framework for big data classification...
Developing a website for English-speaking practice to English as a foreign la...
search engine optimization ppt fir known well about this
Five Habits of High-Impact Board Members
1 - Historical Antecedents, Social Consideration.pdf
Module 1.ppt Iot fundamentals and Architecture
A review of recent deep learning applications in wood surface defect identifi...
O2C Customer Invoices to Receipt V15A.pptx
A contest of sentiment analysis: k-nearest neighbor versus neural network
A comparative study of natural language inference in Swahili using monolingua...
Getting Started with Data Integration: FME Form 101
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Hybrid model detection and classification of lung cancer
Architecture types and enterprise applications.pdf
Modernising the Digital Integration Hub
Chapter 5: Probability Theory and Statistics

Google Go Overview