Modularizing by concerns

When designing modules, it'll be quickly apparent to you that not all modules are alike. Modules can be classified into multiple different types depending on various characteristics. One such classification can be achieved by their functionality or the concerns they address. At the highest level, you can classify modules into two different types:

  • Vertical concerns: Business and application specific functionality. Solves a specific problem in the business domain. For example, the accounts module in a banking application.
  • Horizontal concerns: Crosscutting functionalities that are not business or application specific. Instead, they provide low level functionality or framework that's business-agnostic. For example, logging or security modules.

When designing modules, a good rule to try and follow is to not mix these two concerns. If you design modules specifically for one of the two concerns, it improves clarity and reuse. For example, in the address book application, the module packt.sortutil provided generic sorting ability while being completely agnostic of what it's sorting, thereby addresses a horizontal concern. The module packt.addressbook deals with specific address book application functionality, thereby addressing a vertical concern.

As you can imagine, the type of module influences its design. For instance, reusability wouldn't likely be a primary focus when designing a module addressing a vertical concern, but it's vital when designing a module with cross-cutting concerns.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.221.144