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 ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Friday June 28, 2002
12:28 PM

YAPC day 3: Abigail's two methods of OO

[ #6051 ]

Abigail's talk started off with a basic introduction to objects in the abstract.

Objects need:

  • set of attributes
  • set of methods
  • set of inherited classes
  • means of method dispatch

If methods are closures, the methods contain the attributes for us: instant encapsulation. The attributes would also be lexical instead of hash keys. Typos would be caught by strict.

There was a really neat code example of using OO::Closures.

This is the second talk I've seen where we've seen how to build an OO programming system in Perl. There's actually lots of ways to do this. Perl is the first OO language I ever learned. Really. I have a lot of preconceptions about how things should work that give me problems in other languages, and some of these preconceptions probably give me problems in Perl, as well.

There were no uses of bless here, I believe. You know, some day I'd like to see people come up with a solution for bless besides OO; we've already seen many interesting ways of doing OO without it.

Problems with using hashes:

  • no strictness
  • no encapsulation
  • lots of punctuation

An inheriting class can blow out a parent class's attribute. And of course, those attributes are internal so they are not documented.

Inheritance in Perl is HARD. In order to subclass, you actually ought to look at the code for the superclass and see how it is implemented. That's not what you're supposed to do in OO.

Inside out objects: the person next to me just tilted his head 90 degrees counter clockwise to look at Abigail's slide. I don't think he noticed it. I wonder if it helped.

You can get compile time error messages for nonexistent attributes with this system.

Class::MethodMaker, according to Schwern, isn't possible with strictness. However, source filters answer the problem, according to Abigail. There's a Class::MethodMaker::InsideOut on the way.

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.