Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Surely changing inheritence on the fly is against the idea of the OO patterns in the first place? If you need to change what output you provide by dynamically changing inheritence then I don't see how you can say this alternate technique is OO based. I would be interested in seeing arguments to say that it is.

I have my own arguments against this:

By changing the inheritence dynamically (assuming, of course, that it were possible in any language) you are replicating the same process as interfaces (well sort of). So why muck with the chain (which can have interesting side effects) when the principle of the strategy pattern is to load objects capable of completing the responsibilities of the task via the interface required. The contract is between the calling code and the interface and you assume that it will do what you want. By working on the problem via changing inheritence you are circumnavigating that contract. Ok if you are a sole programmer. Not ok if you are working in a team (or across companies). Its certainly frought with problems.

If this were available I think I would be pretty safe in saying that I would never make use of it.

But that is my 2p. Please take with a pinch of salt :)

S

In reply to Re: Strategy Handles by simon.proctor
in thread Strategy Handles by jdporter

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 studying the Monastery: (7)
As of 2024-03-28 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found