Wednesday, December 15, 2021

Principles of software architecture

Hello folks! Recently, I've been doing some consulting for an e-commerce site. During the review it struck me that there are no ground rules there (or anywhere else for that matter) that would guide what the architecture should look like. So I came up with some points myself:

Principles of architecture

The following describes the principles of the desired state of architecture. Architecture is being viewed in this case not only as the system of interconnected components but as a complete framework for developers, testers, devops and business to know their way around the system.

Ease of development

The following principles will allow for streamlined and effective use of development resources:

  • the technologies being used should be widely adopted to allow for easy sourcing of new resources (developers, designers, testers)
  • both backend and frontend tooling should allow for quick turnaround between changing the code and observing the result
  • manual work to get the changes to appear in local development environment should be eliminated
  • all projects should have a unified API for starting the development environment

Ease of deployment

The following principles will allow for uninterrupted delivery of individual changes:

  • deployment of changes should be automated which includes automated validation of changes as well as pubishing chnaged to production

Extensibility

The following principles will allow for continuous development of new features:

  • the system should obey the law of simple design which dictates that finding the relevant part of the code should be obvious and easy
  • the system should obey the law of extensibility which dictates that changing/adding/removing functionality should be possible without changing parts of the system that are not directly connected to the part being changed/added/removed (derived from the Open/Closed principle)

Maintainability

The following principles will allow for continuous improvements of existing features:

  • the system should be and remain maintainable. This means that both development of new functionalities as well as bugfixes should be as easy and as universaly applicable as possible. For instance, the developer shouldn't worry where to get the data from to reproduce reported errors and how to connect the parts being developed

High availability

The following principles will allow to increase the presence of your app on the market:

  • the system should be able to loose access to parts of it without breaking the user experience. That applies not only to services serving the data (such as the CMS) but also to services serving static resources and custom APIs.

Performance

The following principles will allow to increase the presence of your app on the market:

  • the system should be performant enough to consistently serve every page update under 2 seconds. This leaves 25% margin for variation in delivery time due to connection speed

Security

The following principles will allow to eliminate any potential risks involving unauthorized use of the system thus eliminating losses:

  • the system should not allow for unauthorized users to perform actions they would normally be allowed to accomplish. That includes both accessing frontend pages as well as backend services. Maintaining access to elements of the system should be easy and performant and shouldn't overshadow the essential functionality

Accounting

The following principles will allow to reason about the undesired behavior:

  • the system should employ globally tracable logging facilities

So there you go - a few rules to guide you when you need to decide if what you're doing is good or bad.

The point of this list is not only to show what is important but also to prioritize which parts of it are more important than others so you go top to bottom. If your app isn't a critical one then performance and high availability isn't all that important. If it's being used by just 2 people in the entire company and the app is basically a glorified spreadsheet then security and accounting might not be a concern for you. Regardless of the project size its ease of development, maintainability and extensibility are always key points of any architecture.

Have fun!

No comments: