How to modularize a (large) Java App?

前端 未结 7 1300
感情败类
感情败类 2021-01-30 18:42

I have a rather large (several MLOC) application at hand that I\'d like to split up into more maintainable separate parts. Currently the product is comprised of about 40 Eclipse

7条回答
  •  忘了有多久
    2021-01-30 19:17

    Using OSGi could be a good fit for you. It would allow to create modules out of the application. You can also organize dependencies in a better way. If you define your interfaces between the different modules correctly, then you can use continuous integration as you only have to rebuild the module that you affected on check-in.

    The mechanisms provided by OSGi will help you untangle the existing code. Because of the way the classloading works, it also helps you handle the patches in an easier way.

    Some concepts of OSGi that seem to be a good match for you, as shown from wikipedia:

    The framework is conceptually divided into the following areas:

    • Bundles - Bundles are normal jar components with extra manifest headers.
    • Services - The services layer connects bundles in a dynamic way by offering a publish-find-bind model for plain old Java objects(POJO).
    • Services Registry - The API for management services (ServiceRegistration, ServiceTracker and ServiceReference).
    • Life-Cycle - The API for life cycle management (install, start, stop, update, and uninstall bundles).
    • Modules - The layer that defines encapsulation and declaration of dependencies (how a bundle can import and export code).
    • Security - The layer that handles the security aspects by limiting bundle functionality to pre-defined capabilities.

提交回复
热议问题