in reply to looking towards learning OOP
Thanks for asking this question as I'm (almost) in the same boat. I have some training in Java but rely on Perl for most of what I do. I want to do a re-write of a Perl project from procedural to OO that's becoming increasingly unwieldy and difficult to maintain and expand. Before I start though I've been trying to understand the best way to go about learning OO in Perl and one that I think makes sense.
To me, native Perl OO (blessing an anonymous hash ref) doesn't make sense. You get no encapsulation (and hence potential namespace conflicts) and get none of the benefits of strict and warn since you're storing data according to keys, not hard-coded variables. This is crazy, completely insane! I desperate want strict and warn when I'm trying to make more wieldy code out of my large data structures, and especially when I'm trying to learn how to do it.
So I started investigating inside-out objects, a clever hack on top of Perl's native OO that encapsulates instance data with compile-time checking, just the way I want it. However I got a number of suggestions before settling on Class::InsideOut as the best potential solution (but not without significant reservation). Then I got suggested Moose as a nice OO framework. Moose on the surface looks good but to me it's a huge black box and not part of the standard distro, so my code becomes that much less portable (which is a goal).
So you guess I could say I'm confounded by the TMTOWTDI nature of it all - with objects, seriously, I only need one paradigm that looks and feels like Perl. At this point I'm ready to throw up my hands and just use the native Perl method to see if it's worth all the fuss to avoid it, although I know if anything should go awry I may regret my decision. I look forward to weighing all the suggestions in this thread.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: looking towards learning OOP
by spx2 (Deacon) on Sep 12, 2008 at 21:49 UTC | |
by FunkyMonk (Bishop) on Sep 13, 2008 at 11:16 UTC | |
by tsee (Curate) on Sep 13, 2008 at 09:39 UTC | |
by stvn (Monsignor) on Sep 13, 2008 at 18:00 UTC |