On Tue, 7 Jan 2003, David Graham wrote:

> Date: Tue, 07 Jan 2003 12:17:12 -0700
> From: David Graham <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RE: Struts Coding Standard
>
> Like you said, Struts does not use the source as the documentation.  The
> majority of people looking at the source are contributors and people looking
> to extend the framework.  Member variables should be at the top if for no
> other reason than that's where people expect them to be.
>

As you'll note if you look at much Struts source, I also prefer the
variable declarations at the top :-).

The reason for that was my frustration in trying to read the source for
some method in a class I didn't write, and running into a variable name
out of the blue.  Not only don't I know it's type, I also don't know if
it is static or not, public or not, ...

I read source code top down, and IMHO understanding the variable
declarations is an important prerequisite to understanding the methods.

> David

Craig


>
>
>
>
>
>
> >From: "James Higginbotham" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Developers List" <[EMAIL PROTECTED]>
> >To: "Struts Developers List" <[EMAIL PROTECTED]>
> >Subject: RE: Struts Coding Standard
> >Date: Tue, 7 Jan 2003 12:20:30 -0600
> >
> >I'm not a contributer, but just to mention about putting field at the
> >end of a class definition, I agree.. It tends to jive better with the
> >concept of encapsulation.. Anyone reading the source can see what
> >constructors and public methods (sorted to the top) are available first.
> >They shouldn't have to worry about fields unless they are getting into
> >the guts. Since many OSS projects (not struts) only offer source as
> >their doco, it allows visitors to quickly get up to speed with the API
> >without worrying about the internals. Just my thoughts on this..
> >
> >James
> >
> > > -----Original Message-----
> > > From: David Graham [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, January 07, 2003 10:39 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Struts Coding Standard
> > >
> > >
> > > >
> > > >Another practice I reciently started is placing fields at
> > > the very end
> > > >of a
> > > >class definition, after all methods. It makes comparing the class
> > > >and it's interface. But since struts doesn't use many
> > > interfaces this isn't
> > > >a must
> > > >for me.
> > > >
> > > >-Rob
> > >
> > > That's certainly not a common practice and would confuse most Java
> > > developers looking for the member variables.
> > >
> > > Dave
> > >
> > > _________________________________________________________________
> > > Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
> > > http://join.msn.com/?page=features/junkmail
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-dev-> [EMAIL PROTECTED]>
> > > For
> > > additional commands,
> > > e-mail: <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to