The Awesomeness of Go. Igor Lankin DevFest Karlsruhe, Nov 2016

Similar documents
Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz

Introduzione a Go e RPC in Go

The Go Programming Language. Frank Roberts

Go Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle

Go Language September 2016

Motivations History Principles Language Gommunity Success stories Conclusion. Let s Go! A brief introduction to Google s new language.


Jython. An introduction by Thinh Le

Go on NetBSD (and pkgsrc!) A modern systems programming language 23 March Benny Siegert Google Switzerland; The NetBSD Foundation

Lecture 4: Golang Programming. Lecturer: Prof. Zichen Xu

Using the Go Programming Language in Practice

developed ~2007 by Robert Griesemer, Rob Pike, Ken Thompson open source

go get my/vulnerabilities Green threads are not eco friendly threads

Go Concurrent Programming. QCon2018 Beijing

Go for Java Developers

Pursuit of stability. Growing AWS ECS in production. Alexander Köhler Frankfurt, September 2018

THE GO PROGRAMMING LANGUAGE CHARACTERISTICS AND CAPABILITIES

New Parallel Programming Languages for Optimization Research

Kotlin for Android Developers

Let s Go! Akim D le, Etienne Renault, Roland Levillain. June 8, TYLA Let s Go! June 8, / 58

understanding

func findbestfold(seq string, energyfunction func(fold)float64)) Fold {

Go Tutorial. To do. A brief, gentle intro to Go. Next Networking. q Today

Kotlin for Android Developers

Another Go at Language Design

CS 220: Introduction to Parallel Computing. Introduction to CUDA. Lecture 28

Last Time: Objects and Abstraction. If it walks like a circle, swims like a circle, and quacks like a circle...!

Don t let data Go astray

GO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Introduction to the Go Programming Language

Parallelism. Master 1 International. Andrea G. B. Tettamanzi. Université de Nice Sophia Antipolis Département Informatique

Future Web App Technologies

Go Cheat Sheet. Operators. Go in a Nutshell. Declarations. Basic Syntax. Hello World. Functions. Comparison. Arithmetic. Credits

Das Frontend ist ja dann trivial - Microservices und Web-Frontends. Matthias Reuter & Michael Bruns Darmstadt,

MegoSAT. A concurrent SAT solver in Go. Today: Search for directions. Lukas Prokop

Rheinisch-Westfälische Technische Hochschule Aachen. Lehrstuhl für Datenmanagement und -exploration Prof. Dr. T. Seidl. Proseminar.

Introduction to Xamarin Cross Platform Mobile App Development

Go vs. Swift: The Languages of The Modern Tech Giants

Don t Go Java! Edition 2019

Processor. Lecture #2 Number Rep & Intro to C classic components of all computers Control Datapath Memory Input Output

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Static Deadlock Detection for Go by Global Session Graph Synthesis. Nicholas Ng & Nobuko Yoshida Department of Computing Imperial College London

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

Develop your Embedded Applications Faster: Comparing C and Golang. Marcin Pasinski Mender.io

Go Deep: Fixing Architectural Overheads of the Go Scheduler

Matt Butcher Matt Farina

CS61C Machine Structures. Lecture 3 Introduction to the C Programming Language. 1/23/2006 John Wawrzynek. www-inst.eecs.berkeley.

Cost of Your Programs

Updating the Compiler?

CS377P Programming for Performance Multicore Performance Multithreading

Down the event-driven road: Experiences of integrating streaming into analytic data platforms

Reading How the Web Works

CSCI-GA Multicore Processors: Architecture & Programming Lecture 3: The Memory System You Can t Ignore it!

CSE 333 Lecture 1 - Systems programming

Tranquility Publications. Web Edition MAC

CSE 333 Lecture 1 - Systems programming

Introduction. A. Bellaachia Page: 1

Concurrency in Go 9/22/17

Preview from Notesale.co.uk Page 3 of 79

LEAN & MEAN - GO MICROSERVICES WITH DOCKER SWARM AND SPRING CLOUD

Lecture Overview Methods and Interfaces Methods review Interfaces Example: using the sort interface Anonymous fields in structs

Performance Per Watt. Native code invited back from exile with the Return of the King:

The Go Programming Language. Part 3

Java Thread Programming By Paul Hyde

Cython: A Guide For Python Programmers By Kurt W. Smith

Advance Mobile& Web Application development using Angular and Native Script

JAVA An overview for C++ programmers

GRITS AJAX & GWT. Trey Roby. GRITS 5/14/09 Roby - 1

ENGR 105: Introduction to Scientific Computing. Dr. Graham. E. Wabiszewski

SWIFT & #IOExtendedCLT, 18th May 2016

Go Circuit: Distributing the Go Language and Runtime. Petar Maymounkov

StackVsHeap SPL/2010 SPL/20

It's Time To Get Functional 이건희

ELPREP PERFORMANCE ACROSS PROGRAMMING LANGUAGES PASCAL COSTANZA CHARLOTTE HERZEEL FOSDEM, BRUSSELS, BELGIUM, FEBRUARY 3, 2018

High-Performance and Parallel Computing

Chapter 9 :: Data Abstraction and Object Orientation

Why you should take a look at

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Parallelism and Concurrency. COS 326 David Walker Princeton University

Deep Dive into the ArcGIS Geotrigger Service. Aaron CTO, Esri R&D Center Portland

William Kennedy. Brian Ketelsen Erik St. Martin Steve Francia FOREWORD BY MANNING WITH

Go GC: Prioritizing Low Latency and Simplicity

OpenACC Course. Office Hour #2 Q&A

Building RESTful Python Web Services

HOW TO BUILD A MODERN AI

Technical Game Development II IMGD 4000 (D 11) 1. having agents follow pre-set actions rather than choosing them dynamically

Summarization of Program Development in Multi-core Environment

Java performance - not so scary after all

Quick Review of Object-Oriented Programming in Go

FIVE REASONS YOU SHOULD RUN CONTAINERS ON BARE METAL, NOT VMS

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Thinking Functionally

Embedded type method, overriding, Error handling, Full-fledged web framework, 208 Function defer, 31 panic, 32 recover, 32 33

Lab 4: Interrupts and Realtime

CS Prof J.P.Morrison

Parallelism Marco Serafini

PROGRAMMING GOOGLE APP ENGINE WITH PYTHON: BUILD AND RUN SCALABLE PYTHON APPS ON GOOGLE'S INFRASTRUCTURE BY DAN SANDERSON

The Next Generation of Eclipse: e4. Mike Milinkovich Executive Director Eclipse Foundation

Scientific GPU computing with Go A novel approach to highly reliable CUDA HPC 1 February 2014

Transcription:

The Awesomeness of Go Igor Lankin DevFest Karlsruhe, Nov 2016

Igor Lankin Software Developer @ inovex C#, Java, Java Script, full-time GO (waipu.tv ) 2

What is Go? 3

An Awesome Programming Language 4

Imagine 2007 Awesome Language!!! Sep 21 Robert Griesemer Rob Pike Ken Thompson 5

Why? The World has Changed multicore processors networked systems massive computation clusters tens of millions of lines of code web programming see Go at Google: Language Design in the Service of Software Engineering https://talks.golang.org/2009/go_talk-20091030.pdf 6

Problems Languages did not adapt (well) slow, clumsy development poor concurrency support poor tooling slow compilation 7

New Language 2007 Awesome Language!!! Sep 21 Robert Griesemer Rob Pike Ken Thompson 8

1. Awesome By Design Goal: Create an Awesome Language make programming fun again higher productivity modern language: gc, networking, concurrency 9

Two Years Later 2007 2009 Awesome Language!!! Robert Griesemer Rob Pike Ken Thompson 10

Birth of Go November 10, 2009 11

2. Awesome Mascot: Gopher By Renée French 12

Awesome Result Go native language with "scripty" feeling statically typed, object oriented (kinda) simple, pragmatic, efficient built for scalability, multiprocessing, networking 13

Examples package main import "fmt" type Rect struct { } Width, Height int func main() { sum := 0 for i := 0; i < 10; i++ { if i%2 == 0 { fmt.println(i) sum += i } } fmt.println(sum) } https://play.golang.org/p/6hcgnbt8se func (r *Rect) Area() int { return r.width * r.height } rect := Rect{6, 7} fmt.printf( %v has an area of %d\n, rect, rect.area()) https://play.golang.org/p/vhnwvfy2wl 14

3. Awesomely Readable clean, concise syntax reduced typing no stuttering: foo.foo *myfoo = new foo.foo(foo.foo_init) //?? flat type system clear control flow standardized formatting 15

Tabs vs Spaces 16

4. End of the Holy War TABS! standardized formatting no style guide automatic code formatting (> go fmt) no choice (really) 17

5. Awesome Tooling fast compiler (go build) dependency management (go get) testing, coverage, benchmarks (go test) profiler, static code analysis (go test) documentation, formatting (go doc, go fmt) great editors: vs code, sublime, atom, intellij awesome 3rd-party tools 18

Visualizing Concurrency gotrace: Fan-In https://divan.github.io/posts/go_concurrency_visualize/ 19

6. Awesome Community Share all the code fast-growing open-source libraries, tools, projects easy to share and reuse: import "github.com/aws/aws-sdk-go/aws" docs: godoc.org/github.com/aws/aws-sdk-go/aws github.com/avelino/awesome-go golanglibs.com 20

7. Awesomely Popular http://www.tiobe.com/tiobe-index/ 21

Who is using Go? Cool Folks Only! inovex GmbH, waipu.tv (exaring) Google: Youtube, kubernetes, dl.google.com Apple, Twitter, docker, Dropbox, SoundCloud, github.com/golang/go/wiki/gousers Popular among pythoners, IT-engineers 22

8. Awesome Performance Java < Go < C++ ~10-20% faster in v1.7 (amd64) x% faster in v1.8? (Jan 2017) compiled, garbage-collected superior concurrency => better CPU utilization 23

The End Of Moors Law http://philosophyworkout.blogspot.de/2016/01/a-decade-of-economic-stagnation-looms.html 24

9. Awesome for Concurrency built-in support comprehensible concurrency, that keeps you sane (mostly) 1. lightweight threads (goroutines) 2. safe communication (channels) 25

goroutines go dosomething() 26

func say(text string, delay int) { time.sleep(time.duration(delay) * time.second) fmt.println(text) } func main() { go say("let's go!", 3) go say("ho!", 2) go say("hey!", 1) fmt.println("waiting...") time.sleep(4 * time.second) } https://play.golang.org/p/lmiix-poz0 27

28

Do not communicate by sharing memory; share memory by communicating. - Rob Pike 29

Communicating Sequential Processes (CSP) Interaction between concurrent systems (T. Hoare, 1977) Channel 30

31

var ch = make(chan string) func say(text string, delay int) { time.sleep(time.duration(delay) * time.second) ch <- text } func main() { go consume() go say("let's go!", 3) go say("ho!", 2) go say("hey!", 1) func consume() { for { message := <-ch fmt.println(message) } } } time.sleep(4 * time.second) https://play.golang.org/p/wnslkutrd- 32

goroutines + channels = <3 very powerful concept easy to use safe communication comprehensible concurrency, that keeps you sane (mostly) 33

10. Awesomely Pragmatic Keep it simple pragmatic attitude remove waste (language, tools, libraries) keep things small, comprehensible (minimalistic) lets you focus on the problem 34

11. Awesome for Web Services And more not only for infrastructure cool frameworks for web services small, simple, beautiful but you can also build complex monoliths, too ;) 35

Everything Awesome? "90% Perfect, 100% of the time" Missing features: generics, thread-safe data structures May be confusing: slices, nil, pointers, range variable You need to think differently Modelling can be tricky But it still is pretty awesome! ;) 36

12. Awesomely Easy to Start golang.org welcome/ - A Tour of Go faq/ - FAQ doc/effective_go.html - Deep Dive play.golang.org gobyexample.com - Examples 37

Vielen Dank Igor Lankin Software Developer inovex GmbH Ludwig-Erhard-Allee 6 76131 Karlsruhe @theiigorr