Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: Finding the interface implemented by an object

by stvn (Monsignor)
on Nov 28, 2007 at 15:19 UTC ( #653550=note: print w/replies, xml ) Need Help??

in reply to Re^2: Finding the interface implemented by an object
in thread Finding the interface implemented by an object

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.

  • Comment on Re^3: Finding the interface implemented by an object

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-05-18 00:34 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (68 votes). Check out past polls.