Skip to content
Browse files

2012-09-26 Paris Go

  • Loading branch information...
1 parent 6b81703 commit 3d896266bf0e0bb939dca358c81e240b539889ca @nono committed
View
25 20120926_Golang_introduction/conclusion/conclusion.md
@@ -0,0 +1,25 @@
+!SLIDE
+# Le futur of Go
+
+* Go 1 garantit une stabilité pour quelques années
+* Pour le moment, les efforts se concentrent sur
+ * Corriger les bugs
+ * Améliorer le Garbage Collector
+ * Gagner en performances
+* Voir des projets grandir et retours d'expérience
+* Le travail sur Go 2 n'a pas encore commencé
+
+!SLIDE
+# Conclusion #
+
+* Go n'a pas de fonctionnalité particulièrement sexy
+* Mais c'est un langage agréable
+* Facile à apprendre
+* Qui vous rend productif
+* Et bien adapté aux problèmes du monde réel
+
+!SLIDE
+# Questions ? #
+
+* Les slides sont sur [github.com/nono/Presentations](http://github.com/nono/Presentations)
+* Devblog : [dev.af83.com](http://dev.af83.com)
View
107 20120926_Golang_introduction/concurrency/concurrency.md
@@ -0,0 +1,107 @@
+!SLIDE
+# Concurrence #
+
+Rob Pike :
+
+> Programming as the composition of independently executing processes.
+
+!SLIDE
+# Parallélisme #
+
+Rob Pike :
+
+> Programming as the simultaneous execution of (possibly related) computations.
+
+!SLIDE
+# Concurrence vs. parallélisme #
+
+Concurrence : une question de structure de données
+
+Parallélisme : à propos de l'exécution
+
+!SLIDE
+# Goroutine #
+
+```go
+func computation(n int) {
+ time.Sleep(n * time.Milliseconds)
+ fmt.Printf("%s seconds elapsed\n", n)
+}
+go computation(1)
+go computation(3)
+go computation(5)
+computation(7)
+```
+
+!SLIDE
+# Channels #
+
+```go
+func pingpong(ch chan int) {
+ n := <-ch
+ fmt.Printf("Received %d\n", n)
+ ch <- n
+}
+
+func main() {
+ ch := make(chan int)
+ go pingpong(ch)
+ ch <- 42
+ <-ch
+}
+```
+
+!SLIDE
+# Génerateur #
+
+```go
+func idGenerator() chan int {
+ ids := make(chan int)
+ go func() {
+ id := 0
+ for {
+ ch <- id
+ id++
+ }
+ }
+ return ids
+}
+
+ids := idGenerator()
+id1 := <-ids
+id2 := <-ids
+```
+
+!SLIDE
+# Select #
+
+```go
+select {
+ case c1 <- n:
+ fmt.Printf("c1")
+ case s := <-c2:
+ fmt.Printf("c2")
+ case s := <-c3:
+ fmt.Printf("c3")
+}
+```
+
+!SLIDE
+# Timeout #
+
+```go
+timeout := time.After(2 * time.Seconds)
+select {
+ case n := <-ch:
+ fmt.Printf("Received %d", n)
+ case <-timeout
+ fmr.Printf("Too late")
+}
+```
+
+!SLIDE
+# Goroutines + Channels = <3 #
+
+* Ni mutex
+* Ni semaphore
+* Mais c'est très puissant
View
152 20120926_Golang_introduction/examples/examples.md
@@ -0,0 +1,152 @@
+!SLIDE
+# Hello World #
+
+```go
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello, 世界")
+}
+```
+
+!SLIDE two_cols
+# Déclarations #
+
+```go
+var a int
+var b bool
+a = 15
+b = false
+```
+
+```go
+a := 15
+b := false
+```
+
+!SLIDE
+# Fonctions #
+
+```go
+func hello(who string) string {
+ return fmt.Sprintf("Hello %s", who)
+}
+
+func fibo(a, b int) (int, int) {
+ a, b = a+b, a
+ return a, b
+}
+
+incr := func(n int) int {
+ return n+1
+}
+```
+
+!SLIDE
+# Structures de contrôle #
+
+```go
+if x > y {
+ return x
+} else {
+ return y
+}
+const nb = 10
+for i := 0; i < nb; i++ {
+ fmt.Printf("Iteration n°%d\n", i)
+}
+```
+
+!SLIDE
+# Tableaux et Slices #
+
+```go
+var array [10]int
+var slice []int
+list := []string{"a", "b", "c", "d", "e", "f"}
+other := append(list[0:2], list[3:5]...)
+for k, v := range other {
+ fmt.Printf("%d -> %s\n", k, v)
+}
+// 0 -> a
+// 1 -> b
+// 2 -> d
+// 3 -> e
+```
+
+!SLIDE
+# Maps #
+
+```go
+data := map[string]string{
+ "foo": "bar",
+ "hello": "world",
+}
+for k, v := range data {
+ fmt.Printf("%s -> %s\n", k, v)
+}
+// hello -> world
+// foo -> bar
+```
+
+!SLIDE two_cols
+# Packages #
+
+```go
+package even
+
+func Even(i int) bool {
+ return i%2 == 0
+}
+
+func odd(i int) bool {
+ return i%2 == 1
+}
+
+// Even is exported
+```
+
+```go
+Import (
+ "./even"
+ "fmt"
+ "os"
+)
+
+os.Open(filename)
+fmt.Printf("Hello")
+even.Even(4)
+// Doesn't work:
+// even.odd(3)
+```
+
+!SLIDE
+# Gestion des erreurs #
+
+```go
+f, err := os.Open(name)
+if err != nil {
+ return err
+}
+if _, err := f.Stat(); err != nil {
+ return err
+}
+doSomething(f)
+```
+
+!SLIDE
+# Defer #
+
+```go
+func foobar(name string) error {
+ f, err := os.Open(name)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ fmt.Printf("%v", f)
+ return nil
+}
+```
View
BIN 20120926_Golang_introduction/history/compiling.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
34 20120926_Golang_introduction/history/history.md
@@ -0,0 +1,34 @@
+!SLIDE
+# Il était une fois...
+
+* Ken Thompson
+* Rob Pike
+* Robert Griesemer
+
+!SLIDE
+
+![Compiling](compiling.png)
+
+http://xkcd.com/303/ - CC by nc 2.5
+
+!SLIDE
+# L'histoire complète
+
+[Less is exponentially more](http://commandcenter.blogspot.fr/2012/06/less-is-exponentially-more.html)
+
+par Rob Pike
+
+!SLIDE
+# Pourquoi Go ? Maintenant ?
+
+* Go 1 - c'est stable
+* Un langage Open Source
+* La communauté se construit
+
+!SLIDE
+# Go1 en production
+
+* Google
+* Heroku
+* Cloudfare
+* Canonical
View
8 20120926_Golang_introduction/intro/intro.md
@@ -0,0 +1,8 @@
+!SLIDE
+# Bruno Michel #
+
+* Directeur Technique d'[af83](http://dev.af83.com)
+* Développeur de [LinuxFr.org](http://linuxfr.org/)
+* Ancien président de [Ruby France](http://rubyfrance.org/)
+* [github.com/nono](https://github.com/nono)
+* [twitter.com/brmichel](https://twitter.com/brmichel)
View
13 20120926_Golang_introduction/presentation.json
@@ -0,0 +1,13 @@
+{
+ "title": "Le monde merveilleux de Go",
+ "theme": "memories",
+ "duration": 30,
+ "sections": {
+ "intro": "Présentation",
+ "history": "Historique",
+ "examples": "Les bases de Go",
+ "concurrency": "La concurrence en Go",
+ "productivity": "Améliorer votre productivité",
+ "conclusion": "Conclusion"
+ }
+}
View
85 20120926_Golang_introduction/productivity/productivity.md
@@ -0,0 +1,85 @@
+!SLIDE
+# Code lisible
+
+* Pas de fonctionnalité compliquée
+* => code direct
+
+!SLIDE
+# Pas de free
+
+* Ramasse-miettes
+* On ne perd pas son temps à libérer la mémoire
+
+!SLIDE
+# Une bibliothèque std moderne
+
+* csv, json, xml
+* net/http
+* text/template & html/template
+* time
+* et bien plus !
+
+!SLIDE
+# Les outils go sont géniaux !
+
+* go run hello.go
+* go get github.com/bmizerany/pat
+* go test
+* gofmt
+* etc.
+
+!SLIDE
+# godoc
+
+```text
+% godoc net/http Handle
+PACKAGE
+
+package http
+ import "net/http"
+
+
+FUNCTIONS
+
+func Handle(pattern string, handler Handler)
+ Handle registers the handler for the given pattern in the
+ DefaultServeMux. The documentation for ServeMux explains how patterns
+ are matched.
+
+...
+```
+
+!SLIDE
+# godoc -src
+
+```text
+% godoc -src net/http Handle
+// Handle registers the handler for the given pattern.
+// If a handler already exists for pattern, Handle panics.
+func (mux *ServeMux) Handle(pattern string, handler Handler) {
+ mux.mu.Lock()
+ defer mux.mu.Unlock()
+
+ if pattern == "" {
+ panic("http: invalid pattern " + pattern)
+ }
+ if handler == nil {
+ panic("http: nil handler")
+ }
+ if mux.m[pattern].explicit {
+ panic("http: multiple registrations for " + pattern)
+ }
+
+...
+```
+
+!SLIDE
+# godoc -http=:6060
+
+
+!SLIDE
+# Avantages
+
+* La compilation est très rapide
+* La cross-compilation est facile
+* le déploiement est aisé (no dependency hell)
View
10 20120926_Golang_introduction/titles.css
@@ -0,0 +1,10 @@
+header.slide { background-color: #6c71c4; color: #fff; }
+body section header.slide h1 { font-size: 300%; }
+body section.slide h1 { font-size: 1.0in; }
+body section.slide h2 { font-size: 0.8in; }
+
+.two_cols pre { float: left; width: 43%; margin-right: 4%; }
+
+blockquote { font-style: italic; }
+blockquote p:before { content: '« '; }
+blockquote p:after { content: ' »'; }
View
1 README.md
@@ -30,6 +30,7 @@ Each directory is a set of slide that can be run with
* 2012-02-07 - [TechDays](http://www.microsoft.com/france/mstechdays/) - 45 projects in 45 minutes
* 2012-06-15 - [BreizhCamp](http://www.breizhcamp.org/) - 45 projects in 45 minutes
* 2012-07-09 - [Libre Software Meeting](http://2012.rmll.info) - [Golang introduction](http://nono.github.com/Presentations/20120709_Golang_introduction)
+* 2012-09-26 - [Paris Go](http://groups.google.com/group/parisgo) - [Golang introduction](http://nono.github.com/Presentations/20120709_Golang_introduction)
Contact

0 comments on commit 3d89626

Please sign in to comment.
Something went wrong with that request. Please try again.