• Post Reply Bookmark Topic Watch Topic
  • New Topic

Big Source Code Problems  RSS feed

 
Shiraz Khan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are still in development process and the code of one of classes has exceeded more than 110,000 lines. This has implications on debugging in eclipse. Code above 65k lines cannot be accessed in debugger. Also, Eclipse becomes very slow on opening this code.
We don't want to move any methods to a new class, as it will impact the whole application and there will be lots of code changes.
Is there any way to break this BIG code in atleast two three parts ?
 
Vijitha Kumara
Bartender
Posts: 4002
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! What is this class all about? Does that class has only one reason to CHANGE?
 
Shiraz Khan
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I mentioned, moving methods in a new Class will amount to lots of rework, which I want to avoid.
 
Uli Hofstoetter
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your class is too big, does too many things, probabely violates every known principle of object oriented design and programming and will send you straight to maintenance hell as soon as you need to change anything in it.

Do yourself a favour and refactor it, the sooner the better, because every day passing and every line of code added, will make things worse.

I know this is not the answer you were asking for and not the answer you wanted to hear, but its the only reasonable advice.

Btw, as your are using eclipse, there is quite goode rafctoring support into eclipse and i am sure, your unit tests will reduce the pain during refactoring.

Regards,
Uli
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shiraz Khan wrote:...still in development...code of one of classes has exceeded more than 110,000 lines. ...
We don't want to move any methods to a new class, as it will impact the whole application and there will be lots of code changes.


Eclipse is the least of your problems. Have you considered what a nightmare it is going to be to maintain that code in the future?

I do not mean to offend you, but if our class has these many lines, do yourself a favor, stop coding and return to the drawing board. You need to start with a proper modular design, split into multiple classes, based on logical functionality.
Usually, the rule of the thumb is a class does not ideally exceed ~2000-2500 lines. Of course the actual number can be debatable, but it definitely should not be as high as yours.

Ok. Enough of my cribbing Coming back to your problem.
Easiest and quickest way to fix your problem would be to provide pass through methods in your lumpy class.
Say your lumpy class contains 100 methods with an average of say 20 lines in each method.
Break these 100 methods into multiple classes and transfer the methods in those classes.
In your lumpy class, provide pass through methods which will in turn invoke these distributed methods. That way, the code which invokes the methods in the lumpy class need not be changed. This should ensure minimum code changes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!