- Getting started in Go: Language is easy to pick up but structuring app can be overwhelming. Came from Ruby on Rails background where decisions were made. Progressed while constantly questioning decisions and not feeling productive. Reading tutorials didn't help much.
- Can't we just learn from other languages?: Ruby and Python have frameworks that suggest app structure. In Ruby, Rails is synonymous with web app structure but you can use standard library or Sinatra. Most Ruby and Python developers suggest frameworks. Go developers suggest using standard library instead.
- The values of your programming language matter: Ruby prioritizes development speed and flexibility, Go prioritizes clarity, readability and explicitness. Ruby allows more reflection and metaprogramming like adding methods to
string
type and creating catch-all methods. Go'sreflect
package is limited. Frameworks in Ruby use metaprogramming for fast development at the cost of clarity. Frameworks aren't commonly suggested in Go as it goes against Go's values. - Context is king: Focus on understanding context of application instead of a single structure. Context includes team size, programmer experience, deployment environment etc. Example: Johnny and the author start Go apps differently based on their contexts. A big company values correctness over speed and focuses more on testability. Newer or seasoned developers have different app structure needs. Deploying with microservices or as a monolith also affects app structure.
- In summary: Can't settle on a single app structure in Go due to too many contexts. Goal of the series is to give better advice to new Gophers. Next articles will explore app structures like flat, MVC, domain driven design and discuss pros/cons. Will also cover globals.
- Learn Web Development with Go!: Sign up for mailing list to get a FREE sample from the course - Web Development with Go. Will receive emails about Go coding techniques, upcoming courses and discounts.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。