Java Application Architecture

Modularity Patterns with Examples Using OSGi

Category: Dependency Pattern

Colocate Exceptions

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Exceptions should be close to the class or interface that throw them.
Description
Sadly, dealing with exceptions in enterprise software systems is often an afterthought. But allocation of exceptions to modules has significant implications on the modularity, and more specifically the [...]

Container Independence

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Modules should be independent of the runtime container.
Description
Modules with excessive runtime container dependencies are heavyweight modules that cannot execute outside the confines of the runtime container. Lightweight modules with no container dependencies have significant advantages.

Levelize Modules

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Module relationships should be levelized.
Description
Levelized modules demand that module relationships be acyclic. Any cycles in module relationships therefore prevents levelization. To levelize modules relationships, there are several steps.

Independent Deployment

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Modules should be as independently deployable as possible.
Description
For a module to be independently deployable, it cannot have any outgoing dependencies on any other module.

Physical Layers

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Module relationships must not violate logical layer relationships.
Description
It’s common knowledge that when designing systems of any degree of complexity, the presentation, business logic, and data access should be separated into distinct layers. There are several important considerations when [...]

Acyclic Relationships

For the full description, implementation variations, consequences, and detailed sample, see Page 150 in Java Application Architecture.
Statement
Module relationships should be uni-directional.
Description
When you define a relationship between two system modules, their coupling is increased. Some degree of  coupling is necessary simply because modules need to work together to accomplish some task. But certain types of coupling [...]