Campbell Ritchie wrote:Warning: You will find somebody who will disagree with everything I am about to write.
No, those comments are not too big. They ought not however to have explanation of why you wrote the methods. I would suggest you ought to change them to be documentation comments. I can see a possible logic error in your setBodyType method.I would prefer to see this sort of thingYou might just possibly prefer slightly less rude descriptions
I hope you have never seen any of the three indentation conventions you quoted first, anywhere. They are none of them any good. All miss spaces where there should be spaces and have spaces where there shouldn’t be any. One of them doesn’t show any indentation at all.
We have some suggestions about formatting here. There are several differences from this style guide1: Whether you put { on a line by itself or not. 2: Use of tabs/spaces. 3: Tab = 4 spaces or tab = 8 spaces. I suggest for the time being you always use automatic conversion of a tab to 4 spaces.
As you will have seen I prefer to have { and } vertically aligned with each other, which allows you to see their pairings very easily, only permitting { or } as part of a line when they form parts of an array initialiser.
I am neutral about // end comments, but they become redundant if your {} pairing is obvious. Many people have got used to having [tab]{ at the end of a line, and can see the {} pairing easily.
Note the
/**
*
*/
format for comments. The column of asterisks makes it easier to see where the comment is, particularly if the editor doesn’t highlight comments with a colour.
Two sources about documentation comments:1: Joshua Bloch’s book Effective Java™ 2: This “how to” page.
Campbell Ritchie wrote:What happens when you pass IBM = 35 to that method? I can see more logic problems.
You should usually only quote small parts of a previous post which you are specifically replying to.
If you persist with IBM instead of BMI, it’s IBM Inc
Campbell Ritchie wrote:You’re welcome
But what happened when you set sex=M and BMI/IBM/BIM/MIB to 43? Have you worked it out yet?
Don't get me started about those stupid light bulbs. |