|Pathologically Eclectic Rubbish Lister|
Hacking with objectsby frankus (Priest)
|on Mar 22, 2001 at 21:10 UTC||Need Help??|
I have always thought I was a programmer, making scaleable programs, that were graceful, quick and concise. Until yesterday, I actually started playing with Objects in earnest...
I think my problem is for my current job, I hack Perl and have little time for code reuse since I'm given ten to thirty minutes turn-around. Reuse involves copying and editing the code closest to what I need, or grepping through the bash_history to find that 'one-liner' that was 100+ columns and pretty much did what I wanted.
So with some time on my hands I viewed the work I'd done and abstracted stuff into modules, then the modules to classes. Armed with OO Perl1 perltoot and perlobj and all the code for modules from CPAN, I set forth to make honest readable code that was maintanable and graceful. But the dark thoughts kept coming: put that in the destructor method, make that a class variable, don't use inheritance or overloading where an 'if' gets it done in half the time.
I ended up tying myself in knots divided between hacking a quick and dirty solution to some of my issues rather than being a mature and responsible programmer and making it a scaleable solution.
Other than finish reading OO Perl, which is the obvious answer; which idiom should I use? Part of me says to shun the Object way as it slower and means I don't use as many 80 column commands: The other says - Use Objects and in time all of the cool things will become second nature and they'll work in harmony with your desire for terse code.
So I guess what I want is other people's meditations on Objects in Perl and to see what the majority opinion on Objects in Perl - (What can I say? I'm a pack animal)
1. which like "Moby Dick", I've read much less of than I want to but I find the pages are too crammed with things to fire the imagination that I overload after 5-6 pages and reflect on that for a week or so.