Have at it
publiustemp-londonpm at yahoo.com
Tue Jan 27 15:48:34 GMT 2009
----- Original Message ----
> From: Piers Cawley <pdcawley-london.0dd185@
> A depressing amount of nominally OO code is just procedural code
> wrapped in classes though
Which is terribly depressing, but in the case of Java, there's a tiny defense: sometimes you want to write procedural code but you've no choice but to wrap it up in a class. That tiny (*cough*) little oversight on the part of Java's designers is very frustrating.
That being said, much OO code is very poorly written.
* Liskov? Demeter? Who cares? Those are only theory, right?
* Of *course* I needed that if/else chain to determine what sort of currency I was using.
* What's wrong with my inheritance hierarchy resembling a graph instead of a tree?
* What's wrong with inheritance?
* Hey, I *need* all of those getter/setters.
(Yes, I know that all of these are rules of thumb and sometimes need to be broken and yes, I break them by accident myself).
And the list goes on...
But it's not really the fault of the programmers. I don't see a hell of a lot of stuff out there explain *good* OO practice in Perl. Damian's OO Perl book is great, but he's more focused on different implementations and techniques rather than the *why* of OO (please don't read that as a criticism. His book was sorely needed).
At the end of the day, most OO programmer's code still works. Yes, it's harder to scale, maintain, refactor and contains bugs it shouldn't, but it still works.
And with that caveat, I've got to say that for most Perl programmers, Moose is lovely because it makes declaring a simple class with a constructor and getter/setters easy. Just about everything else if fluff for most.
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
More information about the london.pm