develooper Front page | perl.perl5.porters | Postings from March 2011

Re: Revising Perl's OO docs - a new OO tutorial

Thread Previous | Thread Next
Ricardo Signes
March 6, 2011 16:01
Re: Revising Perl's OO docs - a new OO tutorial
Message ID:
* Aristotle Pagaltzis <> [2011-03-06T17:39:30]
> * Dave Rolsky <> [2011-02-28 21:50]:
> > I've been working on a new OO tutorial for Perl. This is part
> > of a larger goal for the Perl docs to revise all of the
> > existing OO documentation.
> >
> > My new document is available online for review:
> >
> >
> >
> I’m sorry: I hate it. It’s just weak. There’s a lot of a weasel
> language trying to excuse the old way for sucking, without saying
> it sucks, and meanwhile trying to sell the new way, without quite
> invalidating the old way.

First of all, you wouldn't have to apologize much if you would just avoid
saying that there's "weasel language" and "mealy-mouthed politics" without
citing examples.  Do you mean something other than the paragraph containing
"minimalism made a lot of sense in 1994?"

> I don’t think that’s how it should read.

I can't even tell what you think reads that way, because you didn't tell us.

> All that stuff about the historical whys?
> Nobody cares.

All *what* stuff?  What history lesson?  The entire reference to "history"
seems to be saying that "Perl got OO in 1994, and it's pretty minimal, and
you probably want to use something already built on top of that."  It's a
few sentences in a much larger document, and it seems like it does a decent
job explaining why the tutorial is saying that you should use something
beyond just bless.

> [...] An explanation of the old way need not amount to telling people to
> do it like that. It’s perfectly possible to convey how packages,
> functions, references, `bless` and method dispatch relate to each other
> without a full tutorial on how to make use of them bare-bones.
> If nothing else, there is a lot of non-Moose OO code out there already.
> People newly tasked with maintaining such code should not be left
> stranded by the documentation. At least hash-based OO done the old way
> should be accessible to someone coming to Perl 5
> as a novice maintainer. [...]

Dave Rolsky's document does not propose to replace "perlobj," and links to
it, and that contains a fairly complete explanation of how these things
work, for those who want to read about the specifics.  I think everybody
should probably read that.  Maybe doing so should be encouraged at the end
of the "Fundamentals" section.  I don't think it's needed in this document,
which is more "the basics techniques of OO in general, and some ways to use
them easily in your Perl program."

> So all it should do is explain how things work, go into the old
> way long enough to explain hash-based objects (but leave other
> kinds of referents to a footnote), and proceed to cover Moose as
> the practical way of doing OO now.

I think it would be nice to see "how to write a constructor" stuck into the
Fundamentals section.  Do you think much else needs to be added for it to
be complete enough?

> The history lesson should be put off for an appendix though it’s OK to
> have one there – it can help grasp how Perl 5 as a language hangs
> together.

I am really confused by "history lesson" again.

> The community fashion wars have no place in the document.

I don't think anything in there is "fashion wars."  I don't think there are
many questions of fashion here, other than that reflected by having to pick
at least one OO system to display.  Is there a problem with the ones which
were picked, or their ordering?  I don't know what, specifically, you're
objecting to.

> As for the general intro to OO: it’s too short and falls back on
> that useless “an object is a thing, like a person” explanation.
> I ranted about that long ago: <>.
> As a concrete example from computing I suggest a windowing system
> (which, no coincidence, is more or less what inspired OOD at
> all). Any good intro should also probably contain something like
> Damian’s 11 rules for when to use OO.

A more complex, real-world example might be nice and helpful, but right now
Rolsky's document uses the same example as perltoot and one similar to that
in perlboot.  There doesn't seem much harm, on this point, in accepting
this example with a perltodo to improve it.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About