Knowledgebase

Design Patterns: Everything That Matters, Briefly Print

  • softwareengineering, software, troubleshooting, guide, howto, solution, zillionkinghost, hosting
  • 0

The summary.

PATTERNS ARE A VOCABULARY, NOT A GOAL

Applying them because they are known produces complexity with no benefit and code harder to follow than the direct version.

Write the straightforward solution first, and refactor toward a pattern when the need actually appears.

LEARN THE PROBLEMS THEY ADDRESS, NOT THE IMPLEMENTATIONS

The implementation varies by language; the problem does not.

THE MOST VALUABLE IDEA IN THE CREATIONAL PATTERNS

Not creating dependencies inside the things that use them. That is what makes code testable, because they can be substituted.

Singletons introduce global state, hide dependencies and make testing difficult — pass the instance in instead.

SEVERAL BEHAVIOURAL PATTERNS REPLACE CONDITIONAL CHAINS WITH POLYMORPHISM

APPLY TIMEOUTS TO EVERYTHING EXTERNAL, AND MAKE OPERATIONS SAFE TO REPEAT

Retries are inevitable, and a hanging dependency without a timeout holds resources indefinitely.

Backoff must increase and be randomised, or many clients retry simultaneously and worsen the problem.

ANTI-PATTERNS ARISE GRADUALLY, EACH STEP SEEMING REASONABLE

One conceptual change requiring edits in many places means a missing abstraction, or boundaries in the wrong place.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot