Sun thinks it's OK to put private classes in the same source file as the public class they are associated with. Lea doesn't. I think Lea's right. If the classes need refactoring, it will be easier to do if we don't have to manually strip code out of one file and move it into another one.
I'm not sure that either of them are ideal candidates for beginning comments, although I like Lea's idea of explaining why this class is in a particular package. --BillRehm
Opening comments need to give javadoc (or something more powerful on XML) something to do. They also need to explain whatever the code itself doesn't, such as why this class is here, and perhaps even a hint or two about Interfaces and APIs if it comes to that. Lea's guide seems much more capable, and his attitude/style are more conducive to programming. In places, Sun's guide looks like a man page for a text formatter.
( copied from FileOrganization )
back to CodingStyle discussion