Why Do You Need To Know Package Coupling Fundamentals?
fagnerbrack.com
5 min read
View original
Summary (TL;DR)
Package coupling principles help manage dependencies in JavaScript projects. The Acyclic Dependencies Principle (ADP) states that package dependencies must form a directed acyclic graph with no cycles. The Stable Dependencies Principle (SDP) says packages should depend only on packages more stable than themselves. The Stable Abstractions Principle (SAP) requires that stable packages be abstract and unstable packages be concrete. Violating these principles makes code harder to change, understand, and reuse. The article uses a fictional Node.js app called 'The Plumber's Logbook' to illustrate each principle with examples and fixes.