In the past two years, working in a small company, software services company, and also doing freelance on the side, I learned an invaluable lesson, the importance of software architecture.

In my understanding, in simple terms, software architecture refers to the software structure, what design principles will be used, what software or programming language standards will be followed, and the conventions in it’s totally. At the very start of the project these things have to be defined and known.

On my first month working on software development, I was tasked making two big softwares. At the time, whenever I got a project, my first concern, was functionality, make it work, it doesn’t matter how and where the code is placed, just get it done was my suicidal motto. I never thought that I would be the one maintaining it and adding more features two years down the road, and I did as my motto led me, I made it work. This approach is like playing jenga, with each feature added being synonymous to removing a piece in jenga tower.

Looking at those two projects a year later, it’s a mess, I’ve even considered refactoring the entire projects, once or twice. But now it’s impossible at this point, the time is very very limited. Both projects are written in PHP Laravel. Here is my key take away.

1. Group by features not by type

The first and foremost you have to be capable of defining what features are in your app. Types are easy, you have models, views, utilities, services, providers etc. But features can be tricky. All files of all types of a certain feature should be housed in one directory, can have sub-directories for types if a certain type has many files. In projects that have routes like server side applications, then the routes should be grouped by features as well. Also if I am using opinionated framework like Laravel, then I will namespace controllers for example, by features, which will correspond with the routes.

2. Use SOLID design principles

I can’t express how much appreciation of these principles I have right now, during development at first, when starting a project, it is very stressful, as these principles force us to write a lot of code just to implement simple features, but, the payout is on the later later stages of the project. Adding new features becomes very seamless, removing features, finding and fixing bugs, all goes very seamlessly. It’s a blessing.

3. Use a naming convention

Most framework come with their own naming conventions, but this mostly limited to the class names, file names or directory names. When it comes to naming functions, variables, table column names, most frameworks will leave it to the developers, that’s where standards like psr for PHP can help out. And other platforms with just a bit of googling you can find a perfect naming convention that suits your needs. But to have a naming convention is very important, and its an extra if you use one naming convention for all your projects of a specific environment.

That in general is my take on software architecture, however small the project is, always sit down and decide first on how the project’s software architecture will be. Or have a suicidal motto and two years later write an article like me. :D