Get the latest tech news

Layered Design in Go


This post will describe how I design my programs in Go. I needed this for work, and while I searched for a link, nothing quite fits my coding practices out there.

Some people will pile everything into a single package, and while I’m not quite ready to call this unconditionally a bad idea, it does involve sacrificing all ability to use information hiding to maintain invariants, and that is a heck of a tool to put down. On such occasions as I have had to split bits and pieces off into microservices from what was previously a monolith, it has been an almost mechanical process, simply following the dependencies, providing them, and ending up with a functioning service. I would recommend a greenfield project; it is possible but really quite tedious and at times difficult to tear apart an existing system written against another methodology and pull it into this one, though I think that’s just a general rearchitecting truth and not a particular problem with this.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Layered Design

Layered Design