Software Architecture

10 min read

Image
Learn why is it crucial to implement a right architecture in your project.

The first Monday of February was a lucky day for the Gregory. After 5 years of wasting money for the lottery tickets, he finally has won a million. It wasn’t enough to retire, but all he needed to build his own house. Because it was his first serious investment, he decided to be smart and not hire an architect. In his mind, buying a cheap, generic blueprints of the building was enough to hire contractors and start the construction site. He took the yellow pages and started making calls. Within a week he has completed a crew, and on the first day of march the initial meeting took place. It was him and three workers: Tim, Melanie and Jake, all hired independently.

Start of the Project

When Gregory came to the future construction site, all the contractors have already been there. He took the blueprints with him, so the building team can get familiar with the idea. He stepped out of his car, introduced himself to the workers and started the introduction.

“Hi everybody, once again, pleased to meet you all nad thanks for coming.” - he said. “I hope that this meeting will not take long, and you will be able to start the building process as soon as possible”.

The team seemed a little confused, they were looking at each other like trying to get an answer for the question nobody asked. After a moment of silence, Melanie decided to speak.

“Gregory, can I assume that this is the first house you have ever build?” - Melanie asked politely.

“Yes, you can. This is absolutely true.” - Gregory replied.

“That’s fantastic. As you probably know, every construction site requires an architect to give a development team proper guidelines and solve problems showing up during building process. Could you please call this person and arrange another meeting? From what I see you have a blueprints, so we can familiarize with them, but I’m sure we will have many additional questions to ask.” - Melanie took her phone to call an architect.

“Oh yes, the architect. I’ve decided to not hire any, because I purchased a ready to use project from the internet for the fraction of money I would spend for the custom one. And since there is a project, what has left is to hire a proper contractors and start construction site right away.” - Gregory couldn’t be more optimistic than that.

After another moment of silence, this time Tim decided to say a few words.

“Well, Gregory, I’m afraid it doesn’t work like that. If we want to succeed in this project, make it solid and deliver it on time, we need someone who will guide us through. Of course, you have the blueprints, it is helpful and gives us a solid foundation to reason about the house we’re about to build, but during development process many problems will show up. Some of them will be taken care of, but these requiring a bigger picture might fail.” - he explained.

“You might be right, but having an architect is above the budget reserved for this project. You are all experienced contractors, so you should be able to deal with all the problems. You are professionals, aren’t you? You have already build tens of houses, so you know the drill. Just do the best you can, and everything will be just be fine.” - Gregory was very confident with his extraordinary plan.

Through the next few dozens of minutes, the development team was trying to explain Gregory how wrong he is. They agreed that no architect is needed for the small projects, like tool shed or small garage, but not the entire house. Too many things can go wrong in such complicated project, so there must be someone who will get everything together. Unfortunately, they couldn’t convince him to change his mind, so they agreed to his terms and signed the contract. They had six months to finish the house, so construction have started next day.

The Realization

The next six months were tough for both, the team and the Gregory. The first call from the construction site was usually at about 9 a.m., during which the team was reporting more and more problems. Gregory was terrified, because he actually could not help contractors in solving issues they had, just because he had no idea how. His standard answer was: “Please, just figure something out, you are the professional here.”, so they did. Gregory was so tired of this whole situation that he visited the site maybe once or twice, just to show up and answer even more questions. And the team? Well, they did as they were told, and did the best they could.

Now, the question is, what was their plan for this unusual project? Quite simple, since almost everything was up to them, they decided to share tasks evenly, so everybody does the same amount of work. Piece of cake.

Tim took the bathroom and one bedroom. His specialization is carpentry, that’s why he decided to use this material as a main building block for his modules. He also decided to not make the windows. His explanation was short — you don’t need a light when you sleep, and without windows in the bathroom you won’t be seen by your neighbour. What a fascinating train of thought.

Melanie’s assignment was to develop roof, garage and one bedroom. Her material of choice is concrete, especially when it comes together with steel and glass. She decided that roof will be made of glass, especially when some spaces will not have windows. It will give more light during the day and let Gregory watch the night sky during warm, summer nights. For the garage she decided to pour some concrete walls, and use a glass for its door.

The remaining modules like kitchen, hall and entry, were assigned to Jake. He was a magician when it comes to laying out tiles, so his idea of functional space is to put tiles basically everywhere. Walls, floor, even on the ceiling. In his opinion, this is the best material for the places where people live. It is easy to clean, durable and beautiful. The best money can buy.

The Outcome

After 9 months and additional 75 thousand, Gregory could finally move in to his new house. When he came to the site, he saw something unbelievable. His house was like a Dr. Frankenstein’s monster. Walls were made of concrete or wood, most rooms didn’t have windows, and the roof was transparent, so people having their houses on the hill, could see everything what happens inside. There was a drape instead of main door, but the garage was missing any entry at all, just four walls with a roof made of green glass. But the best was yet to come. Electricity for that matter, was not consistent across the building. Some spaces had a regular 230V infrastructure, some had 24V (Jake is afraid of the current), the bathroom and kitchen were equipped with candlestick and matches. Who needs to cook when it’s dark, right? The list goes on and on. Could this be prevented?

Different Aspects Of Software Architecture

When asking an architect or programmer, what actually the Software Architecture is, you may get different answers. Let’s see what “uncles” have to say about it.

Focus On Important Things

Architecture is about the important stuff. Whatever that is.

Ralph Johnson to Martin Fowler during emails exchange

What is the important stuff? It is all that makes your system scalable and maintainable. It is crucial that you know, what parts of your system are responsible for its uninterrupted growth. They will require more attention and work, but it will pay back with faster and more stable development of new features.

The Tempo Of The Growth

High internal quality leads to faster delivery of new features, because there is less cruft to get in the way.

Martin Fowler

How difficult is to add a new module to your system? Does it require a lot of code or creating a huge amount of files? Is it easy to grasp and explain to other developers? Is it dependent on other modules, or rather it communicates with them via some data bus? Does it require a lot of configuration, is it internally consistent? These are just a few from hundreds of questions that can be asked, when trying to measure the quality of the software architecture. The general idea is that less and simpler is better than more and complicated.

Separation Of Concerns

Though these architectures all vary somewhat in their details, they are very similar. They all have the same objective, which is the separation of concerns. They all achieve this separation by dividing the software into layers. Each has at least one layer for business rules, and another for interfaces.

Robert C. Martin (Uncle Bob)

These words concern some of the most common ideas for the software architecture, I will focus on two most popular ones:

If you implement any of these two, you are a step closer to the success of your project. It requires solid planning and discipline, because cruft will make himself comfortable sooner than you might expect. When the push comes to shove, and time is not on your side, you might be tempted to make a shortcut, a dirty workaround, just to release a feature or bug fix as soon as possible. This is the part, when discipline plays an important role. You know that if you give up on quality once, you will probably do it next time. And your team also will, if they see that it’s fine with you. The final result of such practices will be a Big Ball of Mud and group of angry and frustrated developers, who will eventually leave the company. Sad, but true.

Consistency

Can you remember that moment, when you have learned how to ride a bicycle? It was a great experience, wasn’t it? You felt free as an eagle, now you could go much further than you would when traveling on your feet. The world was yours. A moment later, your cousin came to say hi and show you his new bike. You were little scared, when he asked if you want to take a ride, because you had no idea how to ride his bike. You quickly realized that learning how to ride on a bike, is a universal and generic skill, which applies to every copy of this fine machine. The same goes with cars. Once you learn how to shift gears and turn the lights on and off, you can drive all cars in the world, because the way they are driven is consistent.

And how consistency translates to the Software Architecture? It’s simple, like the philosophy behind bicycle or automobile. Learn once to drive them all. If the system is build from components having the same structure, communication and behaviours, you need to learn module architecture only once. It will help you quickly explore the remaining areas of the system, but also the development process will be faster, since you know exactly what to do.

What Gregory’s Case Teaches Us?

According to the unanswered question: “Could this be prevented?”, the answer is obvious — yes, it could. Every complex project (both software and house fall into this category) require someone, who will manage it on the high level. As you can see, the lack of coordinating entity leads to lack of consistency, what leads to lack of quality, and without quality, fast and stable scaling is not possible.