Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

statico (5018)

statico
  ian.langworthNO@SPAMgmail.com
http://langworth.com/
AOL IM: eisforian (Add Buddy, Send Message)

PAUSE-ID: IAN [cpan.org]

Co-author of Perl Testing: A Developer's Notebook [oreilly.com]

Journal of statico (5018)

Tuesday February 01, 2005
10:36 PM

class::contract

[ #22979 ]

C. Garrett Goebel has decided to honor my request of maintaining Class::Contract, which I look forward to hacking on to get some of the "Future Work" functionality described in the documentation. I don't have the time right now to begin working on it, but the TODO section is so deep that improving it may warrant an independent study.

In the meantime, my class partner and I are using it for our software development class, and are so far really excited about it. I understand that pre- and post-conditions are a thesis-worthy topic by themselves (heck, we're one handshake away from the guy who did write the thesis), and Class::Contract seems to Do The Right Thing. Also, it does some Spiffy-esque things, such as automatically shifting $self and providing it through the self function instead. In postconditions, you can have access to the copy of the object that existed before the method/accessor was called via the old function and check the return value via value.

My partner and I really appreciate being able to write:

    # optional callback to notify player of the number of followers they have
    method 'notify_follower_count';
        # ensure first argument is a valid amount of followers
        pre { is_int($_[0]) && 0 <= $_[0] && $_[0] <= 7 };

Hopefully, better-educated, computer science-worthy explanations will follow as the class progresses.

Damian++, Garrett++.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.