Part 2 of 7 · 1 min read
What a module is
A module is a named group of related code. Good grouping makes change cheap.
Think of a toolbox with trays. Screws go in one tray, drill bits in another. When you need a bit, you open one tray. If every tray holds a mix, every job means searching all of them.
FSA uses module as a general word for a group of related code: a class, a function, a package or a namespace. Most languages offer such grouping (a Java package, a .NET namespace). The book notes that this is a logical grouping, not necessarily a physical one. Putting many classes together in one application is convenient. But when the time comes to split the application, loose grouping becomes a problem, because the tight ties between the classes have to be cut.
Module
A module is a named group of related code, such as a class, a package or a namespace.
Example: a package customer holding everything about customers: creating, updating and looking them up.
Why does an architect care? If two packages are tightly tied, reusing one for another job gets hard. And if a change in one forces changes in many others, the system is costly to change. The measures below make this visible.
Check yourself:
- Is a module a physical or a logical grouping, according to FSA?
- Why do loosely grouped classes make a later split harder?