• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can a class be broken into multiple source files?  RSS feed

 
Joe Areeda
Ranch Hand
Posts: 334
2
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is what to do when the source file for a class gets too big ( a judgment call for sure)

Is it possible for one class to be defined in multiple files and if so how do you do it, and is it good practice?

I do see ways to refactor into a base class or move code into a helper class but sometimes the abstraction is cleaner as a single class that does a lot of stuff. My problem is how to organize a BIG class?

Comments and suggestions are more than welcome. I realize it's a vague question.

Thanks,
Joe
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that's not possible. If a class feels too big, it probably is. If you end up with classes hundreds of lines of code long, it's time to break it up.
 
Joe Areeda
Ranch Hand
Posts: 334
2
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the good news I didn't miss a basic operation.

I have to ponder how to break up a Class that is a good abstraction but needs to do a lot.

Thanks Ulf.

Joe
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!