Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Abstract Base classes - [op john gagon]

Reply
Thread Tools

Abstract Base classes - [op john gagon]

 
 
John Gagon
Guest
Posts: n/a
 
      05-17-2006
I'm wondering if there should ever be inheritance instead of
composition. Can you get away with never using extends and just use
field members. I understand that one can use this as an "is a"
relationship but I think interfaces, having multiples of them allowed
are more appropriate.

Some say that one should use a base class if therre is shared
functionality. I've seen it used very usefully for "deferred"
functionality sometimes but I'm still wondering if that can be done by
composition too. What I mean by deferred is that an abstract class's
non-abstract methods calling abstract ones. With composition, it seems
you'd have the enclosing class merely call the method passing in what
it would need and delegating but somehow, it doesn't seem to fit as
well. I thought perhaps "decorator" and lazy instantiation might be
useful or maybe even listener-/action/event model. This all seems a bit
fuzzy and decorators seem rather powerful but also a bit obscure since
the order of nesting seems so arbitrary. Is there a way to control that
with the pattern better?

Thank you.



John Gagon
---
Disclaimer:
All content posted here is the property of John Gagon by virtue of
declaration. John Gagon may revoke this right at any time only via a
formal declaration by John Gagon. If you disagree with John Gagon, keep
in mind that words are not always the things. Everything is relative
and possibly metaphorical. In the event you disagree, it will
automatically be classified as "taken out of context" after which John
Gagon will explain to you the actual context which should clear
everything with formal definitions that will be agreed upon by John
Gagon.

 
Reply With Quote
 
 
 
 
LordAlfredHenry
Guest
Posts: n/a
 
      05-17-2006

John Gagon wrote something John Gagon's mother would be ashamed of:

> I'm wondering if there should ever be inheritance instead of
> composition. Can you get away with never using extends and just use
> field members. I understand that one can use this as an "is a"
> relationship but I think interfaces, having multiples of them allowed
> are more appropriate.
>
> Some say that one should use a base class if therre is shared
> functionality. I've seen it used very usefully for "deferred"
> functionality sometimes but I'm still wondering if that can be done by
> composition too. What I mean by deferred is that an abstract class's
> non-abstract methods calling abstract ones. With composition, it seems
> you'd have the enclosing class merely call the method passing in what
> it would need and delegating but somehow, it doesn't seem to fit as
> well. I thought perhaps "decorator" and lazy instantiation might be
> useful or maybe even listener-/action/event model. This all seems a bit
> fuzzy and decorators seem rather powerful but also a bit obscure since
> the order of nesting seems so arbitrary. Is there a way to control that
> with the pattern better?
>
> Thank you.
>


Hey there, you know, I think it can be useful when there is a very
minor difference or you want to prevent instantiation or preinstantiate
certain values across a bunch of different classes, and as you say,
defer implementation.

LAH.

>
> John Gagon
> ---
> Disclaimer:
> All content posted here is the property of John Gagon by virtue of
> declaration. John Gagon may revoke this right at any time only via a
> formal declaration by John Gagon. If you disagree with John Gagon, keep
> in mind that words are not always the things. Everything is relative
> and possibly metaphorical. In the event you disagree, it will
> automatically be classified as "taken out of context" after which John
> Gagon will explain to you the actual context which should clear
> everything with formal definitions that will be agreed upon by John
> Gagon.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD Verdict reviews: JOHN WAYNE-JOHN FORD FILM COLLECTION and more! DVD Verdict DVD Video 0 06-06-2006 08:23 AM
Abstract Base classes [op john gagon] FrankLewis Software 0 05-17-2006 09:17 AM
format first name from -john- to -John- ? RN ASP .Net 3 02-27-2005 05:34 AM
Abstract Classes w/o abstract methods DaKoadMunky Java 4 04-20-2004 04:53 AM
REVIEW: "The Devil's Code", John Sandford (John Camp) Rob Slade, doting grandpa of Ryan and Trevor Computer Security 0 07-03-2003 06:43 PM



Advertisments