I'm maintaining a Java class that's 40K lines long.. problem?

后端 未结 12 1467
北海茫月
北海茫月 2021-02-04 01:02

This may be a subjective question leading to deletion but I would really like some feedback.

Recently, I moved to another very large enterprise project where I work as a

12条回答
  •  野的像风
    2021-02-04 01:39

    A small thing to pay attention to is the difference between lines, lines of code, and statements. If you analyze your project with e.g. Sonar you can easily see the difference between those.

    Nevertheless, whatever the exact measure, 40k lines of business code is hideous.

    In the business module of an enterprise application I develop, the highest number is 444 lines of code. This is for a rather large Service. Most Service classes are between 200 and 100 lines of code. Entities (model objects) are in our situation mostly between 40 and 100 loc.

    In another part of this same application we have one class that is 1224 lines of code (2477 lines total, 706 statements). This class is almost universally hated within the team because of its size. It's perceived as bloated, complicated and doing way too much.

    Now if an entire team thinks this about a class that's only 2477 lines total, this may give you some perspective about what kind of abomination a 40k lines class is.

提交回复
热议问题