Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S Is 900 lines Of Source In One File Too Much?

 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the class that does most of the GUI work. I don't see how I can break it apart. Functionally, it looks like it should all be in the same class.

If I tried to break it up, there would be lots of duplication and I would probably have 2 650-700 line files.

How many lines do you guys have in your biggest .java file ?
 
Ed Tse
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you didn't use the MVC pattern, It might be harder to break your code up.

If you did use MVC pattern, you can put panels into different classes(have those classes extend JPanel) and pass the the controller to those class for functionality.

Another way to break it up is to put classes that implements listeners other classes. (Again, pass your controller over to those classes)

But 900 line classes are acceptable (My opinion as I have seen a lot of classes w/ 900lines)
[ March 24, 2006: Message edited by: Ed Tse ]
 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, Thanks Ed. Yes I am using MVC. So I think I can break it out to one class per major panel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic