Skip to main content

4. Software Architecture & Principles

What are SOLID Principles?​

Middle

Answer:

  • S: Single Responsibility
  • O: Open/Closed
  • L: Liskov Substitution
  • I: Interface Segregation
  • D: Dependency Inversion SOLID Principles Guide

What is CQRS?​

Middle

Answer: Command Query Responsibility Segregation. A pattern that separates reading data (Query) from writing/updating data (Command).


What is the difference between an Entity and a Value Object in DDD?​

Middle

Answer:

  • Entity: An object with a unique identity (ID) that remains constant even if its properties change (e.g., a User).
  • Value Object: An object defined solely by its attributes; two instances with the same values are identical. They are typically immutable (e.g., Money, Color, Address).

What is the main difference between Hexagonal and Onion architecture?​

Middle

Answer:

  • Hexagonal (Ports & Adapters): Focuses on separating the application from external concerns using Ports (interfaces) and Adapters (implementations). It doesn't prescribe internal layering.
  • Onion Architecture: Uses concentric layers where dependencies always point inward. The Domain Model is at the core, surrounded by Domain Services, Application Services, and finally Infrastructure/UI. Architecture Deep Dive | Practical Examples

What are Anemic and Rich models?​

Senior

Answer:

  • Anemic Model: Models that only contain data (getters/setters) but no business logic.
  • Rich Model: Models that encapsulate both data and business logic (Domain-Driven Design). Anemic vs Rich Model Deep Dive

What is GRASP?​

Senior

Answer: General Responsibility Assignment Software Patterns. A set of principles for assigning responsibilities to classes and objects. GRASP Patterns Guide


What are the pros and cons of Microservices?​

Senior

Answer:

  • Pros: Independent scaling, speed and agility, technology independence, and fault isolation.
  • Cons: Management complexity, data consistency issues (distributed transactions), network latency, and complex monitoring. Microservices Architecture