The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Java Design

Posted by Matt Gerrans on October 19, 2001 at 2:05 PM

I think Bruce Eckel's book, Thinking in Java is better at explaining these things than most other books I've seen. You can get his book online for free at his web site. I think the book Effective Java, by Joshua Bloch may also be helpful for understanding Java design aspects, but I've not yet read that book (I just skimmed over it yesterday; it seems to follow well in the excellent tradition of Scott Meyers' Effective C++ books).

- mfg
- Matt Gerrans

> Abstract classes have important distinction from interfaces.

> interfaces cannot have method body. If base abstract class defines a method, a child does not have to redefine it unless it wants to.

> > 1 ans) If you examine carefully abstract classes provide
> > the defintion or skelton part for members so that any one can
> > implement and custonmize the methods as per the requirements.

> > cheers
> > venu

> > > I wish to ask you certain doubts . While reading the subject , I got the feeling that most of the books are written with the 'how' and not 'why' approach . And certain design aspects are left unanswered .
> > > Like :
> > > 1) why was there a need for 'abstract classes' when ( seemingly) all the functionality could be achieved by the use of interface / concrete classes ?
> > > 2) why didn't Sun provide for multiple inheritance for classes and did it for interfaces - as far as I could reckon , there is virtually no difference between the two ( an interface is as good as an abstract class ) ? ( I am not particularly convinced with the argument that it makes the compilers complex - after all it does exit already in C++ compiler .)
> > > 3) how do togging interfaces viz. 'cloneable', ' serializable' etc. work ; which do not have any methods declared ( or defined ) inside them. Also, are these not the examples of multiple inheritance in some way ?

> > > There must be more design aspects which I have not been able to come up to. I request you to please tell me where I can the answer to these questions as well as a more in depth dealing about why Java is the way it is . Please suggest me the readable books on the topic .


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us