An introduction into Software Architecture

In this article you will learn about the very basics about software architecture and what’s the main job of a software architect.

Picture 1: Robert C. Martin, Clean Architecture, 2020, p. 7

As you can see, after time, code gets exceptionally more expensive.

This chart represents the net cost of code per line. here the costs are starting out pretty low and then get exponentially higher. You may ask: why? The simple answer: bad Software Architecture

How do you define software architecture?

“Software architecture matters because a good one is a key element of your long-term success.”

Beyond Software Architecture, Luke Hohmann 2005, p. 4

Software architecture is all about managing the structure behind your code. You could say that the manifestation of different code files working together defines the architecture of your system. To prove evidence there are several key points which you can measure in your source code, including imports, capsuling different areas and using different protocols to transfer data. All these little bits and pieces add up to the structure of your program – the architecture.

My first project about software architecture

In my personal programming journey I developed a webapp called “yearsinpixels.de”. In a nutshell you could rate your days on a color scale from very bad to fantastic and then see your whole year in different colors in a table. To give you an idea on how it looked like in the end, there is a visualization of a sample table:

In this picture you can see a table like calendar. This horizontal calendar fits on a phone screen in which you can then see every day of the year.
Picture 2: A “year in pixels”

The problem which arose during the final phase of programming was that very simple SQL-Injections within the Login form were possible. Of course, this is a rather big security issue and could simply not be left in the production version.

To make clear, this was my first bigger project in which I really wanted to apply all the stuff I learned previously on several different books on Software Architecture. This was the reason why I programmed alot on my own and didn’t wanted to use any bigger libraries. The prime example for this was the way i handled the data exchange in the backend. In here, wrote my own query engine which was responsible for creating the SQL-queries depending on business data. Normally that’s something you just do not on your own. I just wanted to use some programming patterns I learned from a book called “Patterns of Enterprise Software Architecture” by M. Fowler.

This picture describes the first draft of the software architecture of the app I developed. In it you can see a layered architecture. Within every layer there are different kind of components which all connect together.
Picture 3: Component Graph of “Years in Pixels”

Here you can see one of the first component graphs of the architecture I developed in the process of making the app. To be honest, it was a complete overkill and in many ways I really could have simplified the structure. But again, I think it was a great excercise and i learned alot from it. In the picture you can see different components which all have arrows attached on them. The arrow indicates how the components are depending on each other.

The reason why I am emphasizing so much on the component structure is that you can clearly see the box named “Database Access Component”. So where would you, as a developer, would love to integrate the fix to prohibit these malicious SQL-Injections? Yeah, right! In exactly this component. This has nothing to do with primal security, authorization or even the way API-Requests get handled. These components should not care about these bits of characters in an input-string, they should just send the data and that’s it. And guess what, that’s where the magic happened – 2 commits into the codebase and that was it! Take a look at the following two commits where I did the corresponding changes. (YEAH – Inside the data Layer!)

https://github.com/danielgran/yearsinpixels_data/commit/0fce973cba859d69b4eb3647a5270deb46c55e25

https://github.com/danielgran/yearsinpixels_data/commit/3eae4ec9a6ca251823316d5950bce5a43b852391

To be honest, that example is a bit off. A SPA (Single Page Application) which only really got used from one active user is still OP. I could simply have used a finished Python library which handles data processing with a databank just fine. Yet, as I said – I learnt a hell out of it.

What I’ve learned

In brief, all this not about fancy arrows which are pointing on different boxes and defining pretty components. As noted, software architecture isn’t just that. The real art of all this is detecting what you (and your team) need now, what you might need later and then define structures for you and your team in which they can operate. You as an architect must know your field, be able to foresee all different kind of hurdles which might come across and be prepared for them. Emphatically, you can’t just marry your codebase with any framework that works, which might get deprecated in a year or two. It’s about finding the balance between risk, security, code independence and deciding what is the best for you, your team and the business goals.

Without an architect everyone would play on their own. You are the center part which makes the whole system work fluently.

Contact me

I would love to talk with you about this topic. You can contact me here.

Kindly,

Dani


Posted

in

by

Comments

One response to “An introduction into Software Architecture”

  1. Avery Avatar
    Avery

    Cool website!

Leave a Reply

Your email address will not be published. Required fields are marked *