Hi!

While working on a few parts of the MyFaces codebase the last few times I saw 
increasingly bad style imo. Some of it might be a personal taste, others is 
technically funded. Let's start with the design parts



1.) How many inner classes do we like to use?
 I found 10++ inner classes per class. For no whatever reason - just to make 
the code unmaintainable it seems. One could argue with private access, but hey 
that's bollocks as everyone can tweak private classes via reflections anyway. 
It' just stinks and is not maintainable that way. Also this leads to bad design 
as it's not easy to see what classes we have in there. In 
ServerSideStateCacheImpl there has been 10++ inner classes with 1000 LOC which 
might have EASILY filled an own package!

[ ] Inner classes must only be used for private data holders and similar helper 
classes. Max 2 in a class, not longer than 50 LOC each. 

[ ] I don't care
[ ] Oh yes, inner classes for the win, even if a class hits 5000 LOC because of 
that!


2.) hashCode as key
a hashCode is NOT unique! Using it for a key which must be unique is just dumb.

[ ] Use hashCode + original value for keys. First checking the hashCode and if 
it is the same equals on the original value
[ ] I don't care
[ ] Yea, pleas gimme the full random key collission stuff. I like to get random 
errors in production which are not reproducible - makes my days so sparkling!


LieGrue,
strub

Oh, here is my vote:
[X ] Inner classes must only be used for private data holders and similar 
helper classes. Max 2 in a class, not longer than 50 LOC each. 
[X ] Use hashCode + original value for keys. First checking the hashCode and if 
it is the same equals on the original value

Reply via email to