DEV Community

Irek Mirgaleev
Irek Mirgaleev

Posted on • Originally published at irekm.com

Notes on good software architecture

software architectureUnderstanding software architecture is an essential skill. It allows for creating solutions that evolve the system. Otherwise, it’s too easy to drive it into a swamp from which it never recovers.

Read on, and you will learn:

  • why it is essential to understand software architecture
  • how to improve understanding of a software architecture
  • how to design and sustain good software architecture

Signs of poor software architecture

Poor architecture can show in many ways. The code is hard to test, change and debug. The system is fragile. It’s also prone to security and performance issues. And no one fully understands it.

Know your architecture

1. Ask someone for an initial walkthrough

The codebase is first the place to look, but it’s best to start by asking someone familiar with the system to draw a few boxes and arrows to visualize the main components of the system. Then you can find those components in the codebase and go from there.

2. Use debugger to generate stack traces for main endpoints

One of the best ways to figure out how a system works is to use a debugger.

Find a line in the codebase. Then place a breakpoint and execute the code. A debugger will generate a stack trace.

The stack trace can show all major components that were involved in producing a response to the request. When studying those components, focus on their purpose and not implementation details.

3. Document what you learned

It’s a good idea to write things down as you learn. Otherwise, it’s too easy to forget important details. Once you document your knowledge, you can present it to a group for feedback.

What is good software architecture?

Before trying to create a good architecture let’s define what it means.

  • it expresses its purpose and responsibilities
  • it is relatively easy to make additions and adjustments
  • it is technology/framework agnostic

How to create good architecture

Use the following to help you create good architecture.

1. Follow principles of clean architecture

Uncle Bob is a software development veteran. His advice comes from decades of experience.

2. Have a vision

Requirements should dictate the architecture of a system. Therefore it is highly beneficial to figure out why and what you are trying to build. This idea leads to the next point.

3. Do some design upfront

Scaffold main classes/services and their interfaces before diving into code. You can even stub methods/endpoints with mocked data and build the first proof of concept.

4. Use Domain Driven Design

Domain Driven Design is a methodology that bridges business domain and system implementation. It helps to ensure that the core of the system architecture is entirely dedicated to its business purpose.

5. Use Test Driven Development

TDD helps you in creating better interfaces. Classes end up having better-defined roles and are easier to reuse. And this is just one of many benefits of TDD.

6. Follow SOLID principles

SOLID is a set of principles promoted by Uncle Bob. Learn more at butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod.

7. Design for change

Lastly, the only constant in software is a change. So design your architecture to be flexible.

Top comments (0)