HACKER Q&A
📣 1231232131231

How can I get better at software architecture/design patterns?


I'm at the point where I can complete intermediate/large projects but my architecture isn't as good as I want it to be. I end up using many "Manager" classes, singletons, and sometimes even God classes. I also have trouble breaking everything up into classes/separate files. Any advice?


  👤 Java4StL Accepted Answer ✓
From an Object Oriented Design point-of-view (Java/C++/C#), there are some basic design principles to understand that form the foundation the patterns and frameworks are built on. Many times, understanding these principles and related patterns describe how frameworks and systems operate. The first 4 items are principles and the remaining items are books to read that describe these principles and techniques to leverage them and ways to approach software architecture and development.

1.) Understand the SOLID principles and WHY they matter: -Single Responsibility Principle -Open-Closed Principle -Liskov Substitution Principle -Interface Segregation Principle -Dependency Inversion Principle

2.) Understand the 4 principles of Object Oriented Design and WHY they matter: -Abstraction -Encapsulation -Inheritance -Polymorphism

3.) Understand the 3 types of design patterns: Creational, Structural, and Behavioral. Understand the problem each solves, their respective uses, and which principles they either implement or achieve.

4.) If you write web services (i.e. SOAP/REST), understand the 12 principles of Service Oriented Architecture (i.e. no God classes). Microservices have their own patterns you can explore like Strangler, Saga, orchestration, choreography, etc.

5.) Read "Refactoring" by Martin Fowler (1999) - great book that describes how to approach refactoring application logic safely with improved results, like how to approach a refactoring huge (hard to test and maintain) block of if/else's into a Strategy Pattern, as an example.

6.) Read books written by "Uncle Bob", Robert C Martin: a) Clean Code: A Handbook of Agile Software Craftsmanship (2009) b) Clean Coder: A Code Of Conduct For Professional Programmers (2011) c) Clean Architecture: A Craftsman's Guide to Software Structure and Design. (2017)

7.) READ "Design Patterns" by the "Gang of Four" (GoF) as they're known, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). THIS IS MINIMUM CRITICAL KNOWLEGE.

8.) Read "Domain Driven Design" by Eric Evans (2004).

I hope you don't view the reading this as punting the answer, but time spent reading any of those should help you in your quest to get better at software architecture.


👤 brodouevencode
Not the answer but something worth considering: if you can articulate to a junior developer the pros/cons of different patterns then you're well on your way to being able to find the best fit for the project. And there may be many different patterns used depending on the project and it's size.