Symfony dev learning Golang: errors

Thomas P
2 min readFeb 20, 2018

--

Search a framework

When was the last time you’ve start a new php project without using a framework ? For ages! “Don’t reinvent the wheel” is one of the best advice I’ve get when I start development.

But, it simply don’t match with Go-lang philosophy:

Faster software development, fast compilation and fast to execute.

All recents Go-lang release have speed-up compilation time, reduce memory-footprint, optimize CPU usage. This is a Formula one car, each iteration make it faster and lighter, closest to the language main goal.

On the other side, framework are more likely a utility truck. Whatever you wan’t to do, it will carry everything you need: Routing, logs, cache, JWT, Oauth, Templating, i18n, forms etc… And so, lot of things you won’t need.

Golang have a powerfull and easy package management, pickup only the ones you use. Don’t bring everything.

Try to reproduce Symfony Architecture

When your done playing with Go-lang httpserver, you’ve already made a database connection, and add some middleware, you will probably have enough knowledge to start a small project.

Let’s group the routing declaration in this file, then create a folder to group our entities (uh! struct), doing the same thing to group our managers, our repositories, our providers, our form handlers, our serializers and…” this mess is not for Go.

Golang makes developers munch more productive. Native packages are mostly solving our commons issues without verbose code and efficiently.

Serialization class to Yaml or Json ? useless when you just need to declare the input and output format in your structure:

type Book struct {
Author string `json:"author"`
Title string `json:"title"`
URL string `json:"url"`
}

Lot of things are so munch less verbose in Go, you will probably ask you why you’re creating a file when two lines will made the job.

Like “Premature optimization is the root of all evil”

--

--

Thomas P
Thomas P

Written by Thomas P

Symfony lover, Gopher and opensource enthusiast. Ex-firefighter 🚒, I miss cuting out cars 🚙.

Responses (1)