Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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.

--
Brother Frankus.

In reply to Hacking with objects by frankus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-18 02:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found