I need help finding bed smells in 3 java classes. I'm at a beginner level of refactoring and I've really have problem spotting bed smells. If someone could point them out to me I'll be most appreciated. Thanks...
Because the JavaRanch won't let me for some reason to attach files in .zip, .rar, .txt, .java, .docx etc I have to put my code here:
Can you provide a high level overview of the design. It will make it easier to understand what a class does if we know what the class is suppossed to be
Actually, I would say a bad smell #1:- Missing class level doc. Ideally you should be able to describe what the class represents in couple of lines, and that description should go in class level javadoc. At the very best, lack of javadocs indicates laziness on the part of the developer, and at the worst, it could mean that the developer doesn't think of classes as representation of real entities.
If you find it hard to do one or more of these things, there's probably something that needs to be refactored. I'm kind iffy on the "No documentation is a smell" thing suggested by Jayesh because I believe that code should be self-documenting. OTOH, there are some cases where I do find that some high-level comments can be very helpful indeed in giving the reader an understanding of the intent of the code and the thought process of the authors when they wrote the code and made the design decisions that they made.