How do you decide to group components in software architectures?

by Furious Gamer   Last Updated March 14, 2019 18:05 PM

I am aware that this might be a question with only subjective responses, but i keep coming back to this thought.
When you are designing a software's architecture, do you group components by their kind of task or their "theme"?

For the lack of a better example, if you have a lot file exports to do in your application where one is part of dealing with "billing" but you also have many other components who deal with this theme. Do you group them by the kind of work (which would be exporting here) or by their "theme" (which would be billing)?

Is there any objective way to determine when the one makes more sense than the other in certain scenarios? Not based on taste.

Answers 1

Generally, I prefer to start by grouping by "theme". A better name for "theme" is a bounded context. The idea is that code that changes together should live together.

To extend your example, say you have billing for both goods and services. You may think "oh, this is all billing, so they go together". This may not be the case, as they could have very different rules, invoice scheduled and so on. So you start with a services module and a goods module.

Later, you may discover that you're changing the billing code in both places. Then it becomes time to refactor these things into a common library. You've discovered a new theme - "billing".

March 14, 2019 17:53 PM

Related Questions

Updated June 15, 2016 08:02 AM

Updated April 30, 2018 17:05 PM

Updated March 04, 2019 23:05 PM

Updated September 05, 2017 19:05 PM

Updated May 26, 2018 11:05 AM