in reply to Really Writing Object Oriented Perl
We write a lot of Perl code where I work, and we write a lot of OO Perl in the sense that we use bless and call methods on objects and classes a lot. But I'm starting to realize that we are Perl developers writing OO Perl in much the same way as a C programmer writes Perl, if that makes sense.<rant>
Unfortunately, this makes all too much sense. Perl's OO system is really just a thin veneer over the module system and reference types, which really are just the primative building blocks for a real object system. This is not really all that uncommon though, many languages made the move from structured programming (modules, abstract data types, etc) to OO by similarly enhancing existing features. But as the 90s moved into the 00s and Java became every managers dream come true (and many a developers nightmare) the idea of "True" and "Pure" OO became more important than an OO tacked-on to an existing feature set. To be honest, Perl 5 is behind the times on this, Languages like Python and Ruby, which have much more complete OO systems are really making Perl 5 look bad (at least IMHO). Sure, we have TIMTWODI so we can do our OO any way we want, but in practice this has lead to lots of incompatible approachs and extreme work arounds like Inside-Out classes. If you dont believe me you need only see all the crap people are talking about Perl on the Bugzilla wiki. So much of the "Cons" being brought up are not really cons, but bad usage patterns and misunderstandings of features. And while I really hate to say it, it is my opinion that this is really a case of "TIMTWODI gone bad". A lack of any kind of OO "Best Practices" (and no I do not mean TheDamian's book) is hurting Perl. But anyway enough ranting ...
</rant>I'd love to hear recommendations on what other resources people have found useful for learning how to better apply OO techniques in Perl.
Practice, practice, practice. There are many good OO books out there which teach OO technique (many already mentioned by other posters), but they are no substitute for actually writing real-world code, and even more importantly, maintaining and extending that same code. The cycle of writing and refactoring of an OO codebase over several years has taught me more than any book ever could.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Really Writing Object Oriented Perl
by Joost (Canon) on Jun 01, 2007 at 20:57 UTC | |
by shmem (Chancellor) on Jun 03, 2007 at 20:59 UTC | |
by Joost (Canon) on Jun 05, 2007 at 01:36 UTC | |
by shmem (Chancellor) on Jun 05, 2007 at 11:15 UTC | |
Re^2: Really Writing Object Oriented Perl
by aufflick (Deacon) on Jun 02, 2007 at 13:03 UTC | |
Re^2: Really Writing Object Oriented Perl
by shmem (Chancellor) on Jun 05, 2007 at 11:43 UTC |