Re: abstract classes and generic types
Giovanni Azua wrote:
"Lew" <noone@lewscanon.com> wrote
The coding conventions are documented in
<http://java.sun.com/docs/codeconv/index.html>
(I admit, proudly, that I use the other convention for opening brace "{"
placement.)
I also don't like some of the Sun recommended ways of doing a few things
e.g. to have your implementation details (attributes) listed on top. It is
an implicit bottom-up way of design and thinking counter to the good OO
top-bottom design and good encapsulation. I don't want to see implementation
details, I'd rather like to see the public interface/methods of a class:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc10.html
Used as I am to the conventional way of listing attributes prior to methods, I
found your listing jarring. I like to see things declared prior to their use,
a necessity within the body of methods and initializers, and a comforting
tradition for members. There's something that offends my sensibilities about
not knowing what a thing is until after its use.
Enums are a major exception to the tradition. Because their syntax requires
declaration of the constants before anything else, some of the conventions are
turned upside-down.
I recommend to newbies that they adhere to the convention of declaring member
variables prior to member methods, at least until they've gained enough
experience in Java to decide whether the other way is so superior in every
respect that it's worth violating the convention.
As for seeing the public interface first, that's what interfaces themselves
are for, and part of the motivation for "programming to the interface" as a
recommended practice.
--
Lew