• 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

Number of java files Vs Performance

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am working with a Swing Application with around 5000 java files(already). There may be more with any new support we provide. I have been asked to try and reduce the number(like clubbling of wrapper classes or creating swing components directly on the renderer class rather than call a view panel from there).

My question is would that really help, because there would be some rework plus the classes would become less cohesive & tightly coupled. Isn't that against OO practice? Will reducing the number of files actually improve the performance in some way?

Thanks in advance!
Thejaswini.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, actually, the question seems to be about reducing the number of classes to be maintained, rather than just files in general, but here's my $.02 worth (or Rs0.85, if you prefer).

Reducing classes for the simple sake of reducing classes can be an issue. On the other hand, if there are lots of large, specialized classes, that's an issue too. My experience with the Amiga Exec taught me that if you do a really good job of architectural design, you can not only do more with less, you can do it more efficiently - only about 5 distinct classes comprised the core of the entire Amiga ROM Kernel. In fact, it's the only OS I've ever seen where doubly-linked lists were a fundamental OS service.

This isn't a job that can be done just by getting in and hacking around. You'll need to spend a lot of time mapping out functionality at a high and abstract level. Find commonalities and determine what their core capabilities are. Shift the system components from 1-off implementations to producers and consumers of common services, but walk the fine line between a bloated does-all-things-for-all-people and a minimalistic service that can't do the job. Subclass when necessary, but not gratuitously. Look long and hard at any class whose (generously-commented!) source code comes to more than about 1000 lines.

And, of course, we have one additional trick these days. There's a wealth of third-party classes available to Java programmers. Things like Jakarta Commons. Consider replacing custom system components with library components. While the total app class count may go up, someone else has gone to the trouble of designing them for maximum flexibility and performance, someone else has debugged them and taken responsibility for maintaining them, and someone else has written documentation. In other words, they're someone else's problem. And, since they're industry standards, new people coming in may have a shorter learning curve, since they may either already know them or at least there's more documentation on using them.
 
thejaswini ramesh
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim!
Your reply puts things in perspective
reply
    Bookmark Topic Watch Topic
  • New Topic