Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

While changing the ISA relationships of a class is possible - it's not something that you will often need to do.

A more common perl idiom for changing an objects behaviour is to bless it into another package. You can use this as one way to implement OO state transition systems in perl. Again, this is not something to be done casually.

Part of your confusion might be because of the common misconception that ISA is the only kind of relationship in OO development. It isn't - it's just the most obvious one because it's supported by explicit language constructs.

Other relationships you will see in OO design include:

  • uses - your data-munging object might be given a logging object to use for it's log requests
  • hasa - your car object might have four wheel objects
  • implemented with - you might implement your process scheduling object with a queue object

All these relationships are largely orthagonal to isa relationships. Take a look at Class::Delegation for one way to make these other relationships more explicit.

I'd recommend reading some general OO texts. One of my personal favourites is Meyer's Object Oriented Software Construction. A good read.

Aspect-oriented programming (for perl take a look at the Aspect modules) is another way of looking at the various relationships between objects and classes. I'm not really convinced that this is as radical approach to development as some people say - but it makes interesting reading.

If your problem is purely about categorisation you may find it helpful to look at some of the methods and techniques from artifical intelligence research - the AI:: modules might be a useful starting point.


In reply to Re: perspective and object-disorientation by adrianh
in thread perspective and object-disorientation by Ctrl-z

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 05:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found