Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
There's more than one way to do things
 
PerlMonks  

Class::Classless vs. Class::Prototyped

by John M. Dlugosz (Monsignor)
on Sep 11, 2003 at 19:59 UTC ( #290803=perlquestion: print w/ replies, xml ) Need Help??
John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

I'm thinking of using something like this in a project that seems to be a good fit. That is, the polymorphic behavior can follow from content more easily than having many many distinct classes, and behavior can mutate easier than having if's in every method.

So, any optinions of Class::Classless and other Self-like systems? I'm interested in maturity and ease of use.

—John

Comment on Class::Classless vs. Class::Prototyped
Re: Class::Classless vs. Class::Prototyped
by bsb (Priest) on Sep 12, 2003 at 08:32 UTC
    I'd be interested to know more about your project and why you're considering going down that route. (See: When to use prototype inheritence?). I'm also interested in your experiences after the project.

    There's also Class::SelfMethods by the same guy who wrote Class::Prototyped (Toby Everret). It's worth checking out as it had input from Damian Conway and Sean Burke. (Gleaned from the docs).

    Unfortunately, I haven't got much practical experience with the modules so can't give you much advice. I'm considering emailing these authors to find out how the modules are being used and what the experience have been. I'll report back if I do.

    I have my own, minimal version which is still being designed and debugged and may be ditched for a module implementation
    The important bits follow, just 'new' and an AUTOLOAD accessor.

      Well, I have a number of different record types and modifier flags (http://www.dlugosz.com/ZIP2/structure.html) and I want to model them as Perl objects. They will encode/decode, as well as provide functionality specific to that record type. Notice on that page I have real binary hex-dump examples, as I wrote a simple thing initially. But last I left it, I was working on a more elaborate system of populating both values and behavior based on the initial "type" when new-ing it. On a particular species, for example, a "set" method could check for contraints based on the rules of that specific situation.

      The implementation concept was to have "slots" that could be values or code. That's starting to sound like what these modules do. So why re-invent it?

      —John

Re: Class::Classless vs. Class::Prototyped
by tovod-everett (Sexton) on Sep 16, 2003 at 22:19 UTC
    As the author of Class::SelfMethods and a co-author and current maintainer of Class::Prototyped, I'd like to give the nod to Class::Prototyped.

    While Class::SelfMethods is small and the code is easy to understand, the interface and the whole approach is a hack. It solved the problem I had at the time pretty well, but it was definitely a kludge.

    Class::Prototyped solves a much wider set of problems, has a much cleaner interface and approach, and is all around to be preferred to Class::SelfMethods. It does have a much bigger interface, but the core is still pretty tight and it solves a lot of problems that weren't solved by Class::SelfMethods.

    CP:CSM :: Perl:BASIC

    (Class::Prototyped is to Class::SelfMethods as Perl is to BASIC)

    --Toby Ovod-Everett

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://290803]
Approved by jdtoronto
Front-paged by bsb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2014-04-18 22:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (472 votes), past polls