getting used to Java - question about "style"
From: glunk (stowe_at_whackthisvsac.org)
Date: 06/30/04
- Next message: Chris Smith: "Re: getting used to Java - question about "style""
- Previous message: Phil Hühn: "Re: How do I get String.split() to do what I want?"
- Next in thread: Chris Smith: "Re: getting used to Java - question about "style""
- Reply: Chris Smith: "Re: getting used to Java - question about "style""
- Reply: Tim Ward: "Re: getting used to Java - question about "style""
- Reply: Dario (drinking coffee in the office…): "Re: getting used to Java - question about "style""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 08:54:10 -0400
I am working on my very first Java project. I have been familiar with OO
design for a long time. But I have never put the real thing into practice
(formerly a VB 6 programmer which only buys you encapsulation). My company
is shifting away from VB / ASP solutions and bringing in Java and JSP. I am
one of the ground breakers (God help me).
I am reading a book that a collegue gave me called "The Elements of Java
Style" by Vermeulen, Ambler, Bumgardner, Metz, Misfeldt, Shur and Thompsaon.
(A lot of authors for a really skinny book.) Anyway, ONE OF THE RULES THAT
THEY HAVE IS
"Do not call nonfinal methods from within a constructor."
They go on to explain
"Subclasses may override nonfinal methods and Java will dispatch a call to
such a mrethod according to the actual type of the constructed object -
before executing the derived class constructors. This means when the
constructor invokes the derived method, the derived class may be in an
invalid state. To prevent this, call only final methods from the
constructor."
I cannot understand what this says or means. I know that a final method is
one that cannot be overridden. I do not understand what this parapgraph is
intending to warn me against doing or why. Can someone explain, preferably
with an example?
Thanks!
S
- Next message: Chris Smith: "Re: getting used to Java - question about "style""
- Previous message: Phil Hühn: "Re: How do I get String.split() to do what I want?"
- Next in thread: Chris Smith: "Re: getting used to Java - question about "style""
- Reply: Chris Smith: "Re: getting used to Java - question about "style""
- Reply: Tim Ward: "Re: getting used to Java - question about "style""
- Reply: Dario (drinking coffee in the office…): "Re: getting used to Java - question about "style""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|