How to modularize a (large) Java App?

前端 未结 7 1299
感情败类
感情败类 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:04

    The first thing you need to decide is what infra-structure you will move to. Should it be a lot of independently maintained modules (which translates to individual Eclipse projects) or will you consider it a single chunk of code which is versioned and deployed as a whole. The first is well suited for migrating to a Maven like build environment - the latter for having all the source code in at once.

    In any case you WILL need a continuous integration system running. Your first task is to make the code base build automatically, so you can let your CI system watch over your source repository and rebuild it whenyou change things. I decided for a non-Maven approach here, and we focus on having an easy Eclipse environment so I created a build enviornment using ant4eclipse and Team ProjectSet files (which we use anyway).

    The next step would be getting rid of the circular dependencies - this will make your build simpler, get rid of Eclipse warnings, and eventually allow you to get to the "checkout, compile once, run" stage. This might take a while :-( When you migrate methods and classes, do not MOVE them, but extract or delegate them and leave their old name lying around and mark them deprecated. This will separate your untangeling with your refactoring, and allow code "outside" your project to still work with the code inside your project.

    You WILL benefit from a source repository which allows for moving files, and keeping history. CVS is very weak in this regard.

提交回复
热议问题