• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can a class be broken into multiple source files?

 
Ranch Hand
Posts: 334
2
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic