The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Five Habits of Highly Profitable Software Developers
Subject:  order the source file carefully
Date:  2006-08-24 16:29:08
From:  headius
Response to: order the source file carefully


I disagree with splitting up where variables are located based on visibility. I would agree with ordering them appropriately within the same area of a class. All visibilities of methods may access the same set of variables, and if you have those variables spread across a class determining how they are used without a fancier IDE is extremely difficult. Imagine if you split up public, private, protected, and package-visibility variables throughout the file...when encountering a given variable in a method's implementation, where do you look?

The internals of a class are not part of its public API, so requiring such contortions of variables only complicates maintaining that class. I would rather you non-IDE, non-JavaDoc users have to scroll down a bit to get to the public methods than every developer who follows me having to skip around the file looking for variables.


 Feed java.net RSS Feeds