Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

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

There are two important things to note about the Moose solution, which make it superior to the Class::Std solution.

  1. A Mouse is not a Danger
  2. Inheritance is an "is-a" relationship, and the Class::Std version incorrectly models the Mouse's relationship with Danger. The Moose version states that a Mouse "does" Danger, which still doesn't read quite right, but Danger is clearly more of a Trait of this particular Mouse, and not something that the Mouse "is".

  3. The CUMULATIVE(BASE FIRST) approach lacks a degree of control
  4. Because CUMULATIVE(BASE FIRST) determines the order in which your methods are called, you are limited to how much control you can have. Using the Moose modifiers before/after/around you have a great degree of control over when and how your methods get called. Moose also provides augment/inner which only works with classes (it makes no sense for roles), but also provides a more flexible and powerful means of controlling dispatch. See the Moose::Cookbook::Recipe7 for a good example of this.

It should also be noted (with all due respect to TheDamian) that that Class::Std has 56 outstanding Bugs some over 2 years old and many which are quite serious. It also seems to be no longer maintained (last upload was Feb. 2006). In contrast, Moose is very actively developed by a handful of developers and is being used heavily in several large production sites so bugs tend to get fixed rather quickly.

-stvn

In reply to Re^3: Finding the interface implemented by an object by stvn
in thread Finding the interface implemented by an object by oyse

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 about the Monastery: (6)
As of 2024-04-23 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found