Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: perspective and object-disorientation

by gjb (Vicar)
on Jan 17, 2003 at 23:14 UTC ( [id://227853]=note: print w/replies, xml ) Need Help??


in reply to perspective and object-disorientation

Not every hierarchy is a tree as you mention. This can be solved in several ways:

  1. C++ and other languages (Perl among them) offer multiple inheritance, this means that a class can have multiple base classes. If you start drawing diagrams, you'll notice this can get quite nasty (or at least very tricky) if one exagerates.
  2. Java offers interfaces: one can view this as a kind of contract. Certain functions must be implemented in the class that is to adhere to the interface. This can be done in OO languages that don't support multiple inheritance, but also in C++.
The approach using interfaces has the advantage that one can "attach" properties to a tree. A person could implement the trainspotter interface and offer the method seenWhatTrainsToday().

The issue has been discussed recently in this node, but you might also be interested in the following book:

@book{Lau01,
  author =       {Y.-T.\ Lau},
  title =        {The art of objects: object-oriented design and architecture},
  publisher =    {Addison-Wesley},
  year =         {2001},
  series =       {Object technology series},
  address =      {Upper Saddle River, NJ}
}

Just my 2 cents, -gjb-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://227853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found