Software is one big building with many floors and rooms. Architecture is all around you, regardless of the reason why you’re in the building.
Like posters on the walls of this building, i want to share this article with some mantras that everybody should take in mind.
Mantra #1—It Depends
It always depends. As an architect, you are never sure about anything. There’s always the possibility that you’re missing something. However, the role requires that decisions be made, so you must be able to evaluate all options and make an informed decision, and to do this promptly, when a decision is required. To buy yourself some time and activate your mental processes in the background, first say, “It depends,” and then explain why and what the answer depends on. If you are unsure about what a point depends on, the default answer is, “It depends on the context.”
Mantra #2—Requirements Are Lord Over All
The architect is just one link in the natural chain of actors in a software project. The customer says what he wants. If the customer doesn’t know what he wants, someone will be there to prompt him for specifics. The analyst formalizes what the customer wants. The project manager prepares the groundwork for the formally-defined project. The architect gets the bundle of requirements and sorts them out. Developers follow the architect. The database administrator does his best to make the database support the application effectively. Note that the customer leads the chain, and what the customer wants is the law. What the customer wants goes under the name of requirements. Of course, only few customers know what it is they want. So requirements change.
Mantra #3—Program to an Interface
Even if you make a living out of implemented code, you should leverage interfaces wherever possible. Repeat with us: “No implementation is possible without an interface.” Look around, there’s always an interface that can be extracted.
Mantra #4—Keep It Simple but Not Simplistic
You know KISS (Keep It Simple, Stupid), right? This is just our customized version. Simple and concise is usually equivalent to great and well done. Aim at simplicity, but give yourself a boundary for the low end of the range. If you go below that lower boundary, your solution will become simplistic. And this is not a good thing.
Mantra #5—Inheritance Is About Polymorphism, Not Reuse
Object-oriented programming (OOP) taught us that we should write a class once and reuse it forever and extend it at will. And this is possible thanks to inheritance. Does this naturally extend to class reuse? Reuse is a much subtler concept than you might think at first. Polymorphism is the key aspect of OOP to leverage. Polymorphism means you can use two inherited classes interchangeably. As others have said, “Reuse is a nice side effect to have.” But reuse shouldn’t be your goal, or put another way, don’t reuse a class through inheritance just to reuse the class. It’s better to write a new class that more precisely fits the needs than to try to inherit an existing class that wasn’t designed for the job.
Mantra #6—Not the DAL? Don’t Touch SQL Then
Repeat with us: “Separation of Concerns. Separation of concerns.” Push data access code and details (such as connection strings, commands, and table names) to the corner. Sooner or later, you need to take care of them, but consider business and presentation logic separately from persistence. And if possible, delegate persistence to ad hoc tools such as Object/ Relational Mapper (O/RM) tools.
Mantra #7—Maintainability First
If you could pick only one attribute for your software, what would it be? Scalability? Security? Performance? Testability? Usability? For us, it would be none of the above. For us, what comes first is maintainability. Through maintainability, you can achieve anything else at any time.
Mantra #8—All User Input Is Evil
You should have heard this already. If there’s a way for users to do something wrong, they’ll find it. Oh, this sounds like Murphy’s Law. Yes, you should have heard this one, too, already.
Mantra #9—Post-Mortem Optimization
Donald Knuth said that premature optimization is the root of all software evil. We go even further. Do not optimize the system. Instead, design it for being improved and extended at any time. But focus on pure optimization only when the system is dismissed.
Mantra #10—Security and Testability Are by Design
If you’re serious about a system attribute, design for it right from the beginning. Security and testability are no exception to this rule, and there’s an International Organization for Standardization (ISO) standard that specifically says so.
Microsoft® .NET: Architecting Applications for the Enterprise
By: Dino Esposito; Andrea Saltarello