Structuring larger programs.
WHAT A MODULE IS
A unit of code with a defined public interface and private internals.
WHY THEY MATTER
Without boundaries, everything can depend on everything, and nothing can be changed safely.
WHAT VARIES BETWEEN LANGUAGES
Whether modules map to files or directories How visibility is controlled How dependencies are declared
WHAT TO EXPOSE
The minimum that callers need.
WHY
Everything exposed becomes something you cannot change freely.
WHAT TO ORGANISE BY
The domain, not the technical kind.
WHY
Files that change together should sit together.
WHAT TO ESTABLISH
Which direction dependencies flow.
WHAT THE RULE SHOULD BE
Specific code may depend on general code; not the reverse.
WHAT CIRCULAR DEPENDENCIES CAUSE
Initialisation problems, build failures, and modules that cannot be understood separately.
WHAT TO DETECT AUTOMATICALLY
Those.
WHAT NAMESPACES PROVIDE
Preventing name collisions between modules.
WHAT TO AVOID
Importing everything from a module into the current scope.
WHY
The origin of names becomes invisible.