Phobos classes member declaration order
Ali Çehreli
acehreli at yahoo.com
Thu May 26 13:03:31 PDT 2011
On 05/13/2011 01:10 PM, Alexander wrote:
> Is there any particular reason to declare class members in the
> middle of the class, *after* they are referenced many times?
Currently I put the member variables at the bottom only because our
coding guidelines say so.
In personal code, I prefer putting them at the beginning of the class
because people who look at the source code are the developers. Member
variables tell more about the class than just its public interface.
Anybody who cares only about how a class is used is supposed to be
looking at its documentation.
It is pretty dated at this time, but John Lakos's "Large Scale Software
Design" too recommends putting the members at the top.
Ali
More information about the Digitalmars-d
mailing list