Achieving modularity
medium 45 minA module is a part of the program with a job, a small public face and a hidden inside.
Watch lesson4:58
Where it shows up
The same pattern appears across everyday software.
The JDK itself
JEP 200 split the Java platform into modules. A program can be built with only the modules that it needs.
Go internal packages
Code below a folder named `internal` can be imported only from the tree rooted at its parent. The compiler refuses others.
Node.js package exports
When `package.json` defines `exports`, all other paths are encapsulated. Importing one fails with ERR_PACKAGE_PATH_NOT_EXPORTED.
Shopify and Packwerk
A large Rails program is kept as a modular monolith. Packwerk is the Ruby gem that checks package boundaries and privacy.
Spring Modulith
Describes a module of a Spring Boot program as provided interface, internal parts and required interface, and can verify the structure in a test.
NestJS modules
A module encapsulates its providers. Others can use only what is exported by a module they import.
Rails engines
A part of a Rails program with its own models, routes and a separate namespace, mounted into a host program.
import-linter
Python does not enforce borders, so this tool checks contracts such as layers, forbidden imports and independence.
Gradle java-library
Dependencies are declared as `api` (part of the face) or `implementation` (internal), so users do not see the latter at compile time.