Architectural OCD
Martijn Veldkamp
“Strategic Technology Leader | Customer’s Virtual CTO | Salesforce Expert | Helping Businesses Drive Digital Transformation”
March 8, 2024
A couple of week’s ago the Fridays Nonsense post by Karsten Scherer had an interesting topic that had me thinking about internal systems. He mentioned systems that we are not aware of, until they stop working. For example your inner ear balance.
That post kickstarted my thinking about switching between unconscious and conscious. Becoming aware of feeling uncomfortable. That something is not right, but something is off. What triggers it? Why is a picture on the wall hanging slightly skewed triggering my senses that I notice it immediately? With what framework and expectations am I viewing the world? Or the other way around. What damping and priority settings do I have to handle noise but still alert me when stuff is different?
For example when you walk in a house and you smell something different. “Do you smell that?”. Could be me burning todays dinner, could be the house on fire, could be my wife painting the wall yet another color or the neighbour burning their plastic garbage, again…
Anyway, it is something different. Different then expected. Different then the baseline that we all have. Different enough that it travels through the overload of other sensory input. And get’s priority to override.
Side note:Reacting to something smelling differently is probably a survivor trait. Unconscious response to danger.
Smells
Fresh Prince of Bel Air
To loop back a bit to my professional career. I read about code smells either in a book by Martin Fowler or Kent Beck somewhere in the end of the 90s. Both come to memory when using the phrase “code smells” and possible technical debt.
I think it is the same as seeing stones in a sidewalk not fitting with the rest of the pattern. It “feels wrong”. Like a class with too many responsibilities, very long methods, duplicated code or methods with oh so many parameters. Next to these coding warning signs or anti patterns. There are also governance, processes and architectural smells. Let’s focus on the last part, architectural smells.
Architecture smells
Architectural smells have many examples. Applying a design in an inappropriate context. Or mixing designs that lead to undesirable behaviors. Applying design at the wrong level of granularity. These smells are not always because certain choices were made at the beginning. What I see happening at a lot of my customers is that this iterative development apporoach of their core systems and applications in distributed teams eventually leads to the loss of coherence in their architectural elements.
The moment you as an architect cannot focus on fixing important parts of the design without having to deal with the whole thing all at once. That is a smell.
Types of architectural smells I’ve encountered:
Lack of Separation of Concerns
I see systems where a lot of responsibility and knowledge sits in one component. How to setup a secure connection, orchestrate multiple calls and handle all the translations, handle errors but also maps all the fields and resultsReusability, modifiability, and understandability are impacted. Now every component that wants to send messages need their own implementation of securing a connection, storing secrets, orchestration, etc. Refactoring is an answer, next to education and showing what goods looks like.
Copies are everywhere
Another great anti-pattern is the result of copy and paste. It’s when you see duplications of code addressing the same concerns. Could be due to many reasons. I have seen Salesforce Orgs that paid very low wages to their Salesforce Developers and code was duplicated everywhere. Refactoring is an answer, next to education and showing what goods looks like.
Genericity
It probably isn’t a word, but as a non native speaker I have given myself some leeway. What I mean is an over use of very generic interfaces. So not explicitly modeled out interactions. In Salesforce we have the glorious sObject. Which can be anything really. Case, Contact or Account? It is hard to do dependency analysis when all is sObject. Yes there is a search function in Visual Studio Code and no it is not a replacement.
Conclusion
Code smells help developers figure out when and where they need to tidy up their code. Similarly, architectural smells help architects know where they should tweak their architectural designs. These smells show up when the software breaks some basic rules of how it should be built, like keeping changes separate from each other. But they also give specific signs that can be easily spotted if you have that bit of OCD.
By paying attention to what makes you uncomfortable, you can filters these smells, and make small changes in different parts of your design that over time when added up, make the whole system work a whole lot better.
