Every engineer strives to build good systems, but what is a good system and how do you build it?

A good system needs at least these three traits; it’s easy to maintain, is easy to test and is easy to scale. Let’s dive into what each of those mean.

My goal here is to provide a comprehensive guidebook of principles, tips and best practices for writing better software.

First let’s talk high level…

Maintainability

Managing complexity in a constantly growing application is hard. There are many ways to build software and if we each invented our own way it would be very hard for you and other contributors to keep track of all the different solutions.

We use conventions and design patterns to keep complexity down and make our code easy to read and understand. As the old saying goes; code is written once but read many times by many people.

Testability

We make our apps more reliable and catch bugs earlier by making it easer to test our application and its components.

Having a well designed architecture and following design patterns makes it easier to create isolated components which are easier to test.

The earlier we test, the easier it gets to fix issues.

Scalability

Using a well defined architecture and common design patterns makes it easier to add new features, increases development speed and decreases errors.

Separating concerns and creating reusable components allows teams to add new features without rewriting large pieces of the code or affecting other teams. With good architecture it’s easier to create reusable code which speed up new development.

The principles

We will cover many principles, design patterns, and best practices in this article. To make it easier to navigate I’ve split these into sub-pages. While we stay mostly high-level, there is a list of highly recommended books at the end which dive deeper on these topics.

Everything covered here is worth knowing as an engineer, but every system is specific to it’s domain and it’s needs. Not all of what we cover may be applicable in your codebase.

Throughout the articles there are highlighted principles and patterns which are extra useful or important so pay special attention to them and perhaps dig further with your own research on what they mean for your work.

Planning and design

Before we even start coding we need to consider things like having clear requirements, designing your solution, how to manage your code and other fundamentals.

Planning and design principles

Testing

How should we test our systems or code, what are good things to test, what can we skip. Keep testing simple and keep these other ideas in mind.

Code testing principles

Monitoring

How and why we should think about testing and tips on what to test, and things to monitor.

Software Monitoring

Releasing

What should we pay attention to when preparing for release, how to release and what to monitor once released.

Releasing Software

Code Principles and Design Patterns

What should you be thinking about when organizing and writing the actual code. Architecture and design patterns to follow.

Code Organization

Programming Principles

Architecture and Design Patterns

Refactoring

Regularly refactoring is very important, let’s dive into why, when and how to do that.

Refactoring Principles

Stay curious

Continue to learn and improve by staying up-to-date with the latest language features, frameworks, and best practices. Continuously improve your coding skills through reading, attending conferences, and participating in coding communities.

Regularly review and reflect on your own code and seek feedback from peers to identify areas of improvement. Be open for feedback and stay humble in your reactions.

Books

Much of the content found in this guide is derived or adapted from the following books which I recommend wholeheartedly:

  • Clean Code - Robert C. Martin (“Uncle Bob”)
  • Code Complete - Steve McConnell
  • Design Patterns - Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (”Gang of four”)
  • Refactoring (2nd edition with Javascript)- Martin Fowler
  • Patterns of Enterprise Application Architecture - Martin Fowler
  • Clean Architecture - Robert C. Martin (”Uncle Bob”)