wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Using/extending a Frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using/extending a Frame" Watch "Using/extending a Frame" New topic

Using/extending a Frame

Preeti Yarla
Ranch Hand

Joined: Sep 08, 2007
Posts: 69
For GUI apps I am not sure how you decide between using a frame(has-a relationship) and extending a frame(is-a relationship). In real-time projects does a design requirement say something about it or does the programmer need to decide that?

This may be simple but I don't know how to choose!

[ June 12, 2008: Message edited by: Preeti Yarla ]

arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3219
Check this out http://www.javalobby.org/forums/thread.jspa?forumID=61&threadID=16487

Favor composition over inheritance.
[ June 12, 2008: Message edited by: arulk pillai ]

Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
Preeti Yarla
Ranch Hand

Joined: Sep 08, 2007
Posts: 69
Thanks arulk! The link has good arguments for both composition and inheritance. But I could decide that for all the examples I have been working on so far composition is the right choice.
It is sorta covered in the JavaRanch Style Guide.
subject: Using/extending a Frame
Similar Threads
doubt in IS-A relationship
How to relate two interface ???
Deciding Factor