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
Your domain uses an ILogger interface but you must integrate a legacy logging library that has a different method signature. Apply the Adapter pattern.
// src/ports/ILogger.ts
export interface ILogger {
info(message: string, context?: Record<string, unknown>): void
warn(message: string, context?: Record<string, unknown>): void
error(message: string, error?: Error, context?: Record<string, unknown>): void
}// external/legacy-logger/index.ts
export class LegacyLogger {
log(level: 'INFO' | 'WARN' | 'ERROR', msg: string, meta?: object): void {
console.log(`[${level}] ${msg}`, meta ?? {})
}
logError(msg: string, err: Error, meta?: object): void {
console.error(`[ERROR] ${msg}`, err, meta ?? {})
}
}Produce:
LegacyLoggerAdapter.ts — an adapter class that implements ILogger and delegates to LegacyLogger. The adapter must translate each ILogger method to the correct LegacyLogger call.adapter-analysis.md — one paragraph identifying the incompatibility between the two interfaces and explaining why an adapter is the right choice here (not a facade or a wrapper that changes behavior).clean-architecture
evals
references
design-patterns
solid-principles
testable-design