• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Come and discuss number of classes and interfaces you have created.

 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Is there a limit as to how many classes or interfaces that the project can be consist of. I had done my connection and database portions and I had written 25 classes and interface (including the ones specified by project requirements). Is the number of my classes and interfaces far too many? Or it is considered normal? Anyone passes with more classes and interfaces than I had created? Or had anyone failed because of too many classes or interfaces being created?

My question may sound silly but I hope to have an assurance.

Thanks in advance.

[ June 15, 2004: Message edited by: Clivant Yeo ]

[ June 15, 2004: Message edited by: Clivant Yeo ]

[ June 15, 2004: Message edited by: Clivant Yeo ]

[ June 15, 2004: Message edited by: Clivant Yeo ]
[ June 15, 2004: Message edited by: Clivant Yeo ]
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Clivant:
There isn't any limit on how many classes or interfaces you can create, however if you found yourself building too many, maybe you need to take another look at your design.
 
Marcus Beale
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm also worried about the definition of "reasonable" number of classes.

I recently finished coding all the required functionality for the certification. I've currently got 37 classes and interfaces. I tend to use lots of classes; I think more simple classes are easier to understand than larger, more complicated classes. I'm now considering adding around 5 more classes!

I know the certification says you should make the design easy for a junior programmer to understand, but it doesn't say that means only using a few classes. I think my design is pretty good - I've used several design patterns to separate various pieces of reusable logic. For instance, I have separate classes (and interfaces) for the reading/writing of the database file and searching the database file. This makes it really easy to change your search algorithm, even at runtime. I've gone the extra step in several places that gives me a lot of classes. I think this has clarified the design and responsibilities of the various parts verses complicating them.

I also made some middleware between the server and the client that accounts for some of the additional classes. I'm glad I did make the middleware; looking back it has come in really handy. I put in the padding of database fields here, I lock the entire database before a close, I ensure that the client never (unless it crashes) leaves a record locked, I only give the client a limited number of operations, etc.

I just can't make myself take away good design and flexibility simply to get the number of classes down to some artificial magic number.

Comments and disagreements are welcome.

,Marcus
 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah marcus, I fully agree with you. I am using states and transition for my network connection, I define a common interface for different request and reply that state what the DataServer and DataClient had to do.

I would appreciate anyone who sees this post just state how many classes and interfaces that you had created, be it you had completed the project or in the progess of doing it, thanks.

I just want to have a feel of how many classes everyone had created.
 
Serkan Yazici
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I had 17 classes/interfaces in total. Out of these; 3 were exception classes.

I had plenty of inner-classes and anonymous classes though (especially ActionListeners for GUI elements).
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The number of classes always depends on the type of pattern or design one uses. If one implements this project as static one tier design, then the number of classes shouldn't be more than handfull. If one uses 2 tiers or 3 tiers patterns, then the number of classes will be larger. It is all depends in one assessments of the design. Too many classes in a simple design, will make it harder to maintain, and too few classess in a complex design will also make it harder to maintain.
It is all up to the system architect assessments.
[ June 16, 2004: Message edited by: Hanna Habashy ]
 
Eben Hewitt
Author
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ended up with a total of 75 classes including the interface provided by Sun. I am worried that this is a lot, but I agree with Marcus that it is good to keep classes small. That is what Sun does in their j2ee blueprints--tons of small clasess that each serve a simple purpose.

I also did a GUI for the server, which added about 10 classes, and is not necessary (I did it mostly to help myself during devlopment), and then I sort of went off the deep end with the 'framework' business--that constituted about 15 classes.

But I didn't get my grade yet, so this could be disastrous

Eben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic