- Part 1: Modular Monolith: A Primer
- Part 2: Modular Monolith: Architectural Drivers
Starting with a well designed and internally modularised monolith does seem to be the way to go. When architectural drivers change, like different modules evolving at different rates, it comes natural to split up the monolith into a few modules that are life-cycled and deployed independently, essentially creating micro-services. Scalability concerns in a module is another example of an architectural driver that often leads to such a split up.
You've got several tools at your disposal to keep your monolith properly modularised.
- Designing proper module interfaces used by other parts of the system to interact with the module.
- Use of Java packages to encapsulate modules, while keeping an eye on cyclomatic complexity.
- The Java 9 module system. (Although I haven't used this myself yet.)
- Smart use of multi-module builds in Maven. If you get this right, extracting a module to become its own micro-service might be a relatively trivial matter.