Build Software Like a Home
If software engineers were house builders, they would put the toilet in the living room with the following tag “TODO: move somewhere else”. And will sell the house without seeing any issue.
Architect first, Builder second
What matters the most when you implement a system is not the code: it’s the design. As software engineers, we should be good architects first.
When building a house, choosing the right flooring, paint or door knob is not important. It can be changed at a small cost.
But making mistakes when laying the foundations, putting the plumbing or electrical systems is critical and cost-sensitive.
The same goes for software: you can easily re-write a function, optimize existing code or add a small functionality. It is way harder to migrate your underlying datastore from NoSQL to SQL after you have 100,000s users or switch your frontend library from VueJs to ReactJs.
Before writing code you ship in production, have a good idea of your underlying architecture, how modular it is and how it will evolve as you grow. Make sure you separate concerns between modules: for example, do not render your UI elements in the code that queries your database.
Plan your construction
When you build a house, you sequence work based on physical constraints. For example, you do not install the kitchen sink before the plumbing is done.
I see software engineers focusing on some details before the foundations are correctly laid out. It’s common to see engineers writing detailed code before having deployed anything or even knowing how the code will be executed.
Building software is no different from building a house, and you should come up with a plan. I generally follow these steps:
Write your architecture: diagrams and design documents
Lay out the foundations: deploy an application skeleton that deploys in a staging environment at every push.
Build: write the code of every module and iterate
Polish and finish: add logs, metrics, and monitors
Deliver: deploy in prod
With such a process, every code change is being deployed in minutes. It allows you to iterate, test and deliver as fast as possible.