I am reading and learning on how an application project could be designed better by following the SOLID and CRAP principles. I am quite comfortable in understanding the CRAP principles. However, while researching, I came across the concept of Onion architecture and I am having difficulty wrapping my head around the 2 design concepts and the differences/similarities between the two, if any?
Will an Onion architectured project include the SOLID principle(s)? Does one approach correlate to the other?
The Onion architecture is complimentary with SOLID principles; this is because the SOLID principles are focused on design rather than architecture.
Put differently the Onion architecture is focused on grouping related (by function) classes together into layers, where the classes in the upper layers depend on the classes in the lower layers. The lowest layer (or base layer) is domain classes (those classes that do not change frequently) and the outer layers are the UI, Infrastructure, etc (that is, the classes that change most frequently)
SOLID is focused on classes and how they are designed. The Single Responsibility Principle shows how classes should be constructed in terms of the methods they implement should revolve around one responsibility. The Open / Closed Principles shows how classes should be designed in such a way that changing requirements result in an extension or adding to to existing code rather than modifying existing code. The other principles in SOLID are similar.