SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
Why do I like
                       Go?
                           Ikai Lan - @ikai
                           plus.ikailan.com
                             NYC GTUG
                             July 27, 2011




Wednesday, July 27, 2011
About the speaker

                    • Developer Relations at Google based out
                           of San Francisco, CA
                    • I work on Google App Engine!
                    • Google+: plus.ikailan.com
                    • Twitter: @ikai

Wednesday, July 27, 2011
Why Go?
                    • Fast, modern language
                    • Strongly typed, very flexible interfaces
                    • Functions as first class objects
                    • Ridiculously fast compilation times
                    • Concurrency baked in
                    • Tooling
Wednesday, July 27, 2011
Fast, modern languages

                    • Standard library: JSON, websockets, web
                           server; more
                    • Garbage collection
                    • Multiple return values
                    • Unicode

Wednesday, July 27, 2011
Strongly typed


                    • ... but feels like a dynamic languages
                    •      // Combo statement - We can infer type here, so no
                           Java style type declaration redundancy

                           s := “This is a String”




Wednesday, July 27, 2011
Flexible interfaces
                     // This is an interface declaration
                     type myInterface interface {
                     	   set(i int)
                     }

                     // This is a Type declaration. Note that it is a type, not a class
                     type myType struct {
                         i int
                     }

                     // This is how we define a function where myType is a receiver
                     // With an instance of myType we can call myType.set(123)
                     func (p *myType) set(i int) {
                        p.i = i
                     }

                     // Because myType defines a function with the signature set(int i) method,
                     // we can use it anywhere myInterface is accepted!
                     func setToThousand(x myInterface) {
                        myInterface.set(1000)
                     }




Wednesday, July 27, 2011
First class functions
                package main
                import "fmt"

                // Make a function that returns a new function
                func makeAdd(increment int) (counter func(int) int) {
                        return func(v int) int {
                                return v + increment;
                        }
                }

                func main() {
                        fmt.Printf("value of makeAdd(100)(1) is %vn", makeAdd(100)(1));
                        fmt.Printf("value of makeAdd(200)(2) is %vn", makeAdd(200)(2));
                }

                // Outputs:
                // value of makeAdd(100)(1) is 101
                // value of makeAdd(200)(2) is 202




Wednesday, July 27, 2011
Concurrency baked in

                    • goroutines - prefix a go in front of a
                           method and it will run concurrently! Similar
                           to appending & in *nix systems
                    • channels - blocking or buffered queues for
                           cross process communication




Wednesday, July 27, 2011
Goroutines and
                           package main
                                       Channels
                           import (
                               "fmt"
                               "time"
                           )

                           func doLotsOfWork(until int, ch chan int) {
                               c := 0
                               for i := 0; i < until; i++ {
                                   c += i
                                   time.Sleep(1000)
                               }
                               ch <- c
                           }

                           func main() {
                               ch := make(chan int)

                               // First the work off into the background
                               go doLotsOfWork(5, ch)

                               // Do more work here while we wait for this process to complete

                               // Block until doLotsOfWork sends data back on this channel
                               i := <- ch
                               fmt.Printf("Final value: %vn", i)
                           }


Wednesday, July 27, 2011
It runs on App Engine!
                    • Currently requires whitelisting
                    • Experimental status
                    • Goroutines allow for concurrency within
                           request; concurrent requests coming
                    • Demo app: http://moustach-io.appspot.com/
                    • Source: https://code.google.com/p/
                           appengine-go/source/browse/example/


Wednesday, July 27, 2011
Mustachio




Wednesday, July 27, 2011
Questions?

                    • Go (golang.org) - worth a look
                    • Google+: plus.ikailan.com
                    • Twitter: @ikai


Wednesday, July 27, 2011

Mais conteúdo relacionado

Destaque

Mc Parameter En
Mc Parameter EnMc Parameter En
Mc Parameter En
vasuarez
 
Itha Bridge En
Itha Bridge EnItha Bridge En
Itha Bridge En
vasuarez
 
Itha Bridge En
Itha Bridge EnItha Bridge En
Itha Bridge En
vasuarez
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
ikailan
 
Spectrum En
Spectrum EnSpectrum En
Spectrum En
vasuarez
 
Linearization En
Linearization EnLinearization En
Linearization En
vasuarez
 
2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore
ikailan
 
Rc Analysis En
Rc Analysis EnRc Analysis En
Rc Analysis En
vasuarez
 
Column Simulation En
Column Simulation EnColumn Simulation En
Column Simulation En
vasuarez
 
Rc Design En
Rc Design EnRc Design En
Rc Design En
vasuarez
 

Destaque (17)

2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
 
Security in Pervasive Computing Environments
Security in Pervasive Computing EnvironmentsSecurity in Pervasive Computing Environments
Security in Pervasive Computing Environments
 
Mc Parameter En
Mc Parameter EnMc Parameter En
Mc Parameter En
 
Itha Bridge En
Itha Bridge EnItha Bridge En
Itha Bridge En
 
Itha Bridge En
Itha Bridge EnItha Bridge En
Itha Bridge En
 
State machines for gesture recognition
State machines for gesture recognitionState machines for gesture recognition
State machines for gesture recognition
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
 
2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore
 
Spectrum En
Spectrum EnSpectrum En
Spectrum En
 
Linearization En
Linearization EnLinearization En
Linearization En
 
2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore2011 july-gtug-high-replication-datastore
2011 july-gtug-high-replication-datastore
 
Rc Analysis En
Rc Analysis EnRc Analysis En
Rc Analysis En
 
Donttrythisathome
DonttrythisathomeDonttrythisathome
Donttrythisathome
 
Column Simulation En
Column Simulation EnColumn Simulation En
Column Simulation En
 
OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010
 
Rc Design En
Rc Design EnRc Design En
Rc Design En
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 

Semelhante a 2011 july-nyc-gtug-go

Python introduction
Python introductionPython introduction
Python introduction
Roger Xia
 
NodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time WebNodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time Web
Jakub Nesetril
 
Concurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background TasksConcurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background Tasks
WO Community
 
Format of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptxFormat of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptx
MOHAMMADANISH12
 

Semelhante a 2011 july-nyc-gtug-go (20)

Python introduction
Python introductionPython introduction
Python introduction
 
RunDeck
RunDeckRunDeck
RunDeck
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developers
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Clojure, Plain and Simple
Clojure, Plain and SimpleClojure, Plain and Simple
Clojure, Plain and Simple
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10
 
Basic Scheduling with setTimeout & setInterval
Basic Scheduling with setTimeout & setIntervalBasic Scheduling with setTimeout & setInterval
Basic Scheduling with setTimeout & setInterval
 
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
 
NodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time WebNodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time Web
 
Concurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background TasksConcurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background Tasks
 
Plone api
Plone apiPlone api
Plone api
 
Anish PPT-GIT.pptx
Anish PPT-GIT.pptxAnish PPT-GIT.pptx
Anish PPT-GIT.pptx
 
Format of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptxFormat of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptx
 
PPT-GIT.pptx
PPT-GIT.pptxPPT-GIT.pptx
PPT-GIT.pptx
 
Sync considered unethical
Sync considered unethicalSync considered unethical
Sync considered unethical
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
Iterarators and generators in python
Iterarators and generators in pythonIterarators and generators in python
Iterarators and generators in python
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
PRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptxPRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptx
 
What is Python?
What is Python?What is Python?
What is Python?
 

Mais de ikailan (8)

Your language doesn't scale
Your language doesn't scaleYour language doesn't scale
Your language doesn't scale
 
From 0-1 billion in 46 days
From 0-1 billion in 46 daysFrom 0-1 billion in 46 days
From 0-1 billion in 46 days
 
2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth
 
Intro to App Engine - Agency Dev Day NYC 2011
Intro to App Engine - Agency Dev Day NYC 2011Intro to App Engine - Agency Dev Day NYC 2011
Intro to App Engine - Agency Dev Day NYC 2011
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon
 
Introducing the App Engine datastore
Introducing the App Engine datastoreIntroducing the App Engine datastore
Introducing the App Engine datastore
 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

2011 july-nyc-gtug-go

  • 1. Why do I like Go? Ikai Lan - @ikai plus.ikailan.com NYC GTUG July 27, 2011 Wednesday, July 27, 2011
  • 2. About the speaker • Developer Relations at Google based out of San Francisco, CA • I work on Google App Engine! • Google+: plus.ikailan.com • Twitter: @ikai Wednesday, July 27, 2011
  • 3. Why Go? • Fast, modern language • Strongly typed, very flexible interfaces • Functions as first class objects • Ridiculously fast compilation times • Concurrency baked in • Tooling Wednesday, July 27, 2011
  • 4. Fast, modern languages • Standard library: JSON, websockets, web server; more • Garbage collection • Multiple return values • Unicode Wednesday, July 27, 2011
  • 5. Strongly typed • ... but feels like a dynamic languages • // Combo statement - We can infer type here, so no Java style type declaration redundancy s := “This is a String” Wednesday, July 27, 2011
  • 6. Flexible interfaces // This is an interface declaration type myInterface interface { set(i int) } // This is a Type declaration. Note that it is a type, not a class type myType struct { i int } // This is how we define a function where myType is a receiver // With an instance of myType we can call myType.set(123) func (p *myType) set(i int) { p.i = i } // Because myType defines a function with the signature set(int i) method, // we can use it anywhere myInterface is accepted! func setToThousand(x myInterface) { myInterface.set(1000) } Wednesday, July 27, 2011
  • 7. First class functions package main import "fmt" // Make a function that returns a new function func makeAdd(increment int) (counter func(int) int) { return func(v int) int { return v + increment; } } func main() { fmt.Printf("value of makeAdd(100)(1) is %vn", makeAdd(100)(1)); fmt.Printf("value of makeAdd(200)(2) is %vn", makeAdd(200)(2)); } // Outputs: // value of makeAdd(100)(1) is 101 // value of makeAdd(200)(2) is 202 Wednesday, July 27, 2011
  • 8. Concurrency baked in • goroutines - prefix a go in front of a method and it will run concurrently! Similar to appending & in *nix systems • channels - blocking or buffered queues for cross process communication Wednesday, July 27, 2011
  • 9. Goroutines and package main Channels import ( "fmt" "time" ) func doLotsOfWork(until int, ch chan int) { c := 0 for i := 0; i < until; i++ { c += i time.Sleep(1000) } ch <- c } func main() { ch := make(chan int) // First the work off into the background go doLotsOfWork(5, ch) // Do more work here while we wait for this process to complete // Block until doLotsOfWork sends data back on this channel i := <- ch fmt.Printf("Final value: %vn", i) } Wednesday, July 27, 2011
  • 10. It runs on App Engine! • Currently requires whitelisting • Experimental status • Goroutines allow for concurrency within request; concurrent requests coming • Demo app: http://moustach-io.appspot.com/ • Source: https://code.google.com/p/ appengine-go/source/browse/example/ Wednesday, July 27, 2011
  • 12. Questions? • Go (golang.org) - worth a look • Google+: plus.ikailan.com • Twitter: @ikai Wednesday, July 27, 2011