Strategic architecture, tactical design, and testable code principles (SOLID, Clean Architecture, Design Patterns, Testable Design)
97
97%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Classes that change for the same reasons and at the same times should be in the same component. This is the Common Closure Principle (CCP) - the Single Responsibility Principle for components.
Incorrect (classes that change together are separated):
src/
├── entities/
│ └── Invoice.ts # Changes when billing rules change
├── repositories/
│ └── InvoiceRepository.ts # Changes when billing rules change
├── services/
│ └── InvoiceService.ts # Changes when billing rules change
├── validators/
│ └── InvoiceValidator.ts # Changes when billing rules change
└── mappers/
└── InvoiceMapper.ts # Changes when billing rules change
# A billing rule change touches 5 directories
# Risk of forgetting one, inconsistent changesCorrect (classes that change together are grouped):
src/
├── billing/
│ ├── domain/
│ │ ├── Invoice.ts
│ │ ├── InvoiceLine.ts
│ │ ├── InvoiceRules.ts
│ │ └── InvoiceValidator.ts
│ ├── application/
│ │ ├── CreateInvoiceUseCase.ts
│ │ └── ports/
│ │ └── InvoiceRepository.ts
│ └── infrastructure/
│ ├── PostgresInvoiceRepository.ts
│ └── InvoiceMapper.ts
├── payments/
│ └── ... # Changes for different reasons
└── shipping/
└── ... # Changes for different reasons
# Billing rule change isolated to billing/
# Single PR, single review, single deploymentHow to identify change reasons:
clean-architecture
evals
references
design-patterns
solid-principles
testable-design