我正在维护一个40K行长的Java类..问题? [英] I'm maintaining a Java class that's 40K lines long.. problem?
问题描述
这可能是导致删除的主观问题,但我真的想要一些反馈。
This may be a subjective question leading to deletion but I would really like some feedback.
最近,我转到另一个非常大的企业项目,我在那里工作开发商。我惊讶地发现项目中的大多数课程的长度从8K到50K不等,方法长度为1K到8K。它主要是处理数据库表和数据管理的业务逻辑,充满了处理用例的条件语句。
Recently, I moved to another very large enterprise project where I work as a developer. I was aghast to find most classes in the project are anywhere from 8K to 50K lines long with methods that are 1K to 8K lines long. It's mostly business logic dealing with DB tables and data management, full of conditional statements to handle the use cases.
这些类在大型企业系统中是否常见?我意识到没有看代码很难做出决定,但是你曾经在一个有这么大的类的系统上工作吗?
Are classes this large common in large enterprise systems? I realize without looking at the code it's hard to make a determination, but have you ever worked on a system with classes this large?
推荐答案
以下是JDK 6中按行计数7209 .java文件的十大类。这些类包含大量可能比代码更长的注释。
Here are the ten largest class in the JDK 6 by line count of 7209 .java files. These classes include significant amount of comments which could be longer than the code.
4495 ./javax/sql/rowset/BaseRowSet.java
4649 ./java/awt/Container.java
5025 ./javax/swing/text/JTextComponent.java
5246 ./java/util/regex/Pattern.java
5316 ./javax/swing/JTree.java
5469 ./java/lang/Character.java
5473 ./javax/swing/JComponent.java
9063 ./com/sun/corba/se/impl/logging/ORBUtilSystemException.java
9595 ./javax/swing/JTable.java
9982 ./java/awt/Component.java
我同意一个打印页面足够长的方法。确实应该不需要超过10K行的IMHO。
I would agree one printed page is long enough for a method. There really should not be a need for classes over 10K lines long IMHO.
这篇关于我正在维护一个40K行长的Java类..问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!