golang #5: to go or not to go
TRANSCRIPT
![Page 2: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/2.jpg)
Go is an optional language released in 2012( It does not force you using it likeJava for Android or Obj-C for iOS )
Why is it so popular today?
![Page 3: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/3.jpg)
![Page 4: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/4.jpg)
Who are switching to Go?
(definitely not mobile devs)
![Page 5: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/5.jpg)
![Page 6: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/6.jpg)
Why Go?
1. Single binary deployment2. Minimal language3. Easy concurrency4. Full development environment5. Multi-arch build6. Low-level interface7. Getting started quickly
![Page 7: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/7.jpg)
Nope. Only 1 reason.
![Page 8: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/8.jpg)
Nope. Only 1 reason.
It just works!
![Page 9: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/9.jpg)
Remember the day when you wrote your first program in University.
int main(int argc, const char* argv[]) {printf("%s", "Hello world");return 0;
}
$ ./helloHello world
![Page 10: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/10.jpg)
Then things get so complex…
![Page 11: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/11.jpg)
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…
![Page 12: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/12.jpg)
Why get into trouble?
![Page 13: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/13.jpg)
Why get into trouble?
Programming languages are tools to build my beautiful applications.
Nothing more!
![Page 14: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/14.jpg)
Why people create so many things tosimplify 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.- …
![Page 15: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/15.jpg)
Because development is hard.
![Page 16: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/16.jpg)
Because development is hard.
Life is short.
Keep building your awesome applications.
![Page 17: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/17.jpg)
Just Go!
![Page 18: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/18.jpg)
Just Go!
import "fmt"func main() {
fmt.Println("Hello world!")}
$ ./helloHello world!
![Page 19: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/19.jpg)
1. Cross platform build2. Garbage collector3. Run on multiple-core by default4. Easy to learn and write5. Consistent coding style, easy to read others’ code6. Super easy deployment and config7. Good and consistent performance8. No more crazy “AbstractUniversalFactory…”9. No more OOP, ORM, fancy frameworks, …
Just write code that matter.
![Page 20: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/20.jpg)
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)
}
![Page 21: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/21.jpg)
Go is a language for engineers
• Go make development life simplerbut do not try to hide nasty things.
• You still need your computer science knowledge.
![Page 22: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/22.jpg)
When not Go?1. Mobile development2. Web development3. Game development4. Data scientist5. Low-level drivers6. Performance critical code7. Prototyping applications8. MVC applications9. Shared host (PHP, ASP.NET)
![Page 23: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/23.jpg)
When not Go?1. Mobile development → Java, Obj-C, .NET2. Web development → JavaScript3. Game development → Game engines4. Data scientist → Python, R5. Low-level drivers → C, Rust6. Performance critical code → C, C++, Rust7. Prototyping applications → Node.js8. MVC applications → PHP, ASP.NET, Ruby on Rails9. Shared host (PHP, ASP.NET) → Wordpress!
![Page 24: Golang #5: To Go or not to Go](https://reader033.vdocuments.us/reader033/viewer/2022042907/5870636c1a28ab48378b4681/html5/thumbnails/24.jpg)
When Go?
1. Distributed environmentServer development, web services, api
2. PortableCommand line tools
3. You care about team productivityand good performance & quality.