Big class decomposition in Java

前端 未结 5 912
深忆病人
深忆病人 2020-12-28 20:45

I have just started to learn Java and is curious is it any good practice in Java for good object decomposition? Let me describe a problem. In big software project it\'s alwa

5条回答
  •  醉梦人生
    2020-12-28 21:03

    The next logical step may be to change the BigClass into a java package. Next create new objects for each group of related functionality (noting in each class that the object is part of the new package).

    The benefits of doing this are dependency reduction and performance.

    1. No need to import the entire package/BigClass just to get a few methods.
    2. Code changes to related functionality don't require a recompile/redeploy of the entire package/BigClass.
    3. Less memory used for allocating/deallocating objects, since you are using smaller classes.

提交回复
热议问题