Golang #5
TO GO
or
NOT TO GO
Vu Nguyen
vu.nguyen@will.vn
Go is an optional language released in 2012
( It does not force you using it like
Java for Android or Obj-C for iOS )
Why is it so popular today?
Who are switching to Go?
(definitely not mobile devs)
Why Go?
1. Single binary deployment
2. Minimal language
3. Easy concurrency
4. Full development environment
5. Multi-arch build
6. Low-level interface
7. Getting started quickly
Nope. Only 1 reason.
Nope. Only 1 reason.
It just works!
Remember the day
when you wrote your first program in University.
int main(int argc, const char* argv[]) {
printf("%s", "Hello world");
return 0;
}
$ ./hello
Hello world
Then things get so complex…
What is “AbstractUniversalModelFactoryBuilder” ?
When will we use “abstract class” or “interface” ?
Hey, “callback” or “promise” or “async.js” or “yield”?
How to run your app on multiple-cores computers ? (hint: Node.js “cluster”)
How to correctly install all these dependencies?
“MVC” or “ORM” or “EntityFramework” or “name-your-fancy-framework” ?
Why my database got “undefined” instead of my beautiful numbers?
Why did you use “tab” instead of “4 spaces” ?
Then things get so complex…
Why get into trouble?
Why get into trouble?
Programming languages are tools to
build my beautiful applications.
Nothing more!
Why people create so many things to
simplify life of developers?
- Create applications without writing code.
- Build real-time mobile applications without server code.
- Automatically scale up without manually config.
- ORM, frameworks, and IDE.
- …
Because development is hard.
Because development is hard.
Life is short.
Keep building your awesome applications.
Just Go!
Just Go!
import "fmt"
func main() {
fmt.Println("Hello world!")
}
$ ./hello
Hello world!
1. Cross platform build
2. Garbage collector
3. Run on multiple-core by default
4. Easy to learn and write
5. Consistent coding style, easy to read others’ code
6. Super easy deployment and config
7. Good and consistent performance
8. No more crazy “AbstractUniversalFactory…”
9. No more OOP, ORM, fancy frameworks, …
Just write code that matter.
Writing a web server
import (
"net/http"
"fmt"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello World!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
Go is a language for engineers
• Go make development life simpler
but do not try to hide nasty things.
• You still need your computer science knowledge.
When not Go?
1. Mobile development
2. Web development
3. Game development
4. Data scientist
5. Low-level drivers
6. Performance critical code
7. Prototyping applications
8. MVC applications
9. Shared host (PHP, ASP.NET)
When not Go?
1. Mobile development → Java, Obj-C, .NET
2. Web development → JavaScript
3. Game development → Game engines
4. Data scientist → Python, R
5. Low-level drivers → C, Rust
6. Performance critical code → C, C++, Rust
7. Prototyping applications → Node.js
8. MVC applications → PHP, ASP.NET, Ruby on Rails
9. Shared host (PHP, ASP.NET) → Wordpress!
When Go?
1. Distributed environment
Server development, web services, api
2. Portable
Command line tools
3. You care about team productivity
and good performance & quality.
Golang #5
THANK YOU
Vu Nguyen
vu.nguyen@will.vn

Golang #5: To Go or not to Go

  • 1.
  • 2.
    Go is anoptional language released in 2012 ( It does not force you using it like Java for Android or Obj-C for iOS ) Why is it so popular today?
  • 4.
    Who are switchingto Go? (definitely not mobile devs)
  • 6.
    Why Go? 1. Singlebinary deployment 2. Minimal language 3. Easy concurrency 4. Full development environment 5. Multi-arch build 6. Low-level interface 7. Getting started quickly
  • 7.
    Nope. Only 1reason.
  • 8.
    Nope. Only 1reason. It just works!
  • 9.
    Remember the day whenyou wrote your first program in University. int main(int argc, const char* argv[]) { printf("%s", "Hello world"); return 0; } $ ./hello Hello world
  • 10.
    Then things getso complex…
  • 11.
    What is “AbstractUniversalModelFactoryBuilder”? When will we use “abstract class” or “interface” ? Hey, “callback” or “promise” or “async.js” or “yield”? How to run your app on multiple-cores computers ? (hint: Node.js “cluster”) How to correctly install all these dependencies? “MVC” or “ORM” or “EntityFramework” or “name-your-fancy-framework” ? Why my database got “undefined” instead of my beautiful numbers? Why did you use “tab” instead of “4 spaces” ? Then things get so complex…
  • 12.
    Why get intotrouble?
  • 13.
    Why get intotrouble? Programming languages are tools to build my beautiful applications. Nothing more!
  • 14.
    Why people createso many things to simplify life of developers? - Create applications without writing code. - Build real-time mobile applications without server code. - Automatically scale up without manually config. - ORM, frameworks, and IDE. - …
  • 15.
  • 16.
    Because development ishard. Life is short. Keep building your awesome applications.
  • 17.
  • 18.
    Just Go! import "fmt" funcmain() { fmt.Println("Hello world!") } $ ./hello Hello world!
  • 19.
    1. Cross platformbuild 2. Garbage collector 3. Run on multiple-core by default 4. Easy to learn and write 5. Consistent coding style, easy to read others’ code 6. Super easy deployment and config 7. Good and consistent performance 8. No more crazy “AbstractUniversalFactory…” 9. No more OOP, ORM, fancy frameworks, … Just write code that matter.
  • 20.
    Writing a webserver import ( "net/http" "fmt" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello World!") } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
  • 21.
    Go is alanguage for engineers • Go make development life simpler but do not try to hide nasty things. • You still need your computer science knowledge.
  • 22.
    When not Go? 1.Mobile development 2. Web development 3. Game development 4. Data scientist 5. Low-level drivers 6. Performance critical code 7. Prototyping applications 8. MVC applications 9. Shared host (PHP, ASP.NET)
  • 23.
    When not Go? 1.Mobile development → Java, Obj-C, .NET 2. Web development → JavaScript 3. Game development → Game engines 4. Data scientist → Python, R 5. Low-level drivers → C, Rust 6. Performance critical code → C, C++, Rust 7. Prototyping applications → Node.js 8. MVC applications → PHP, ASP.NET, Ruby on Rails 9. Shared host (PHP, ASP.NET) → Wordpress!
  • 24.
    When Go? 1. Distributedenvironment Server development, web services, api 2. Portable Command line tools 3. You care about team productivity and good performance & quality.
  • 25.