visit
What is a Module?
Dictionary say a module is “one of a set of separate parts that, when combined, form a complete whole”
So a module needs to have two main characteristics:What is Modular thinking?
Modular thinking would involve the following:1. Break down the problem in small parts i.e. modules. Each part would satisfy the following:But why Modularity?
What do we gain from modular approach to the solution? I think the following three are the primary benefits:Logical & Physical Modules
In software applications, logical grouping of functions and services is done to create a modular design. This would be an outcome of the application of Software Architecture principles on the problem domain e.g., the following modules may be identified for a Ticket Booking application, each focused on a specific area of the solution.a. an executable file containing all the modules. Here, the modules may internally be organized separately in the source tree of the application, but physically they all are in one executable file produced by building the application.
b. each module is a library and the application is using the libraries. Libraries are built and released separately from the main Application.
It is said that Unit of Release is the Unit of Reuse. There is no scope for reuse in Option (a).
Required Platform Capabilities
To support the modularity of option (b), a platform used to build the software application needs to have at least the following capabilities:*The package structure at runtime is used to locate .class files. JVM would look for exact same directory structure as the package name e.g. all types under “com.covidservice.api.service” should be found under “com/covidservice/api/service” on the Classpath JARs. So a package is not really treated as a dependency by JVM. JVM searches for .Class file when it has to create a new Class or Instance — this is different from how dependencies are managed in Java 9 and .Net.
**Java does not support versioning at JVM layer. The versions of JARs are maintained using naming convention i.e. including version in JAR filenames like spring-web-1.0.0-RELEASE.jar. If you have wrong version on Classpath or Modulepath, JVM would use that as long as the .Class file (Java 8) or Module (Java 9) are found.
Before module system was introduced in Java, came up with a dynamic module system. is an industry alliance for “a vendor-independent, standards-based approach to modularizing Java software applications and infrastructure”. OSGi was formed in late 1990s. There are many implementations of OSGi specifications like Apache Felix, Eclipise Equinox, etc.OSGi component system is used to build Eclipse IDE, JBoss, WebLogic, etc.
Summary
Modular architecture is a necessity once complexity and scope grows beyond certain point. It is difficult to introduce modularity at a later stage so better to do it from the beginning.Modular design can be created by applying principles of Software Architecture, but platforms used to build the software need to support modular architecture. Java 9 and .Net are more capable than Java 8 — for reasons explained above — to enforce modularity.Previously published at