You have to understand both to know when to use OO, and how much is appropriate.

This is my problem. If I were coding in Java or C++ I'd play it by the numbers, because the voices in my head don't tell me to make this code as terse (basically, at least for Java a well trained Labrador can understand the code, so where's the fun?).

But for me, in my less sober moments, Perl is for being a wizard and bending the rules if not breaking them or taking 3 words from one rule and sticking them with half a dozen from another.

So the desire to use Good OO principals is not always at the forefront of my mind. What I was commenting on was the desire to hack using OO.

In the same way that on a certain day you might bung all the processing for a piece of code in a regular expression and know it is `baaad'; I'll say rather than have a for loop and an item before the for loop and an item after the for loop I'll make an object do the first thing in the constructor the for stuff in a method and the bit after the for loop in the destructor function, and believe me in this situation it is brevitous, feasable and reusable.

When I'm feeling mischevous or bored or lazy why should I feel bad about misusing the tools of OO? Being in awe of OO stops the use of some cool features, why should I have to be an OO Designer?

I like the food analogy, I like food :-).

--
Brother Frankus.

In reply to Hacking with objects by frankus
in thread 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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.