View Single Post
Old Jul 1st, 2005, 8:02 AM   #11
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,315
Rep Power: 5 grumpy will become famous soon enough
Quote:
Originally Posted by stevengs
You know, I generally prefer to list my attributes (private) first too, but every member of the crew at my new place of work unanimously agrees that the methods should be listed first (they are quite nitpicky when it comes to things like that.. sheesh). Not that it is really of much importance, but which is seen more often?
Usually I see public members (and attributes, if any) placed first in a header. The usual reason given is that private/protected members are implementation details, while public members are what is necessary to use the class. And, if more than one person uses the class, it is better to place what they need near the top of the header rather than forcing someone to scroll down through implementation details they aren't interested in.

People who care about the ability of customers to use their class library are often notable for insisting that public members appear near the top of a class declaration. That probably means that people who prefer private members near the top are more concerned with making it easier to modify the class implementation, and less concerned about the impact that has on other people who use their classes.
grumpy is offline   Reply With Quote