The proficient programmer is not unlike the experienced mechanic.

She or he will have learned various paradigms, an assortment of different ways of looking at problems, and how to use a wide variety of tools. Then when presented with a task, will use experience and judgement to grab the tool that seems to best fit the task. And this practitioner will choose an overall approach that might not seem obvious to a beginner, but that in the end simplifies the project.

Object oriented programming is one way of approaching a problem. It's not the only way, and it's not necessarily the best way. The best way will be the way that fits best within the greater project, that is most maintainable, that meets efficiency requirements, that follows accepted coding norms for an organization... but most importantly, the one that solves the problem most effortlessly. Sometimes the primary task is only part of the problem. Other components of the problem might be things such as the ability to extend the solution later on. Some of these sorts of concerns are not obvious to a beginner.

I sometimes find taking an object oriented approach leads to over-engineering what ought to be a simple problem. Other times, I find that it helps keep a non-trivial problem manageable. But the same can be said of functional techniques sometimes. Once in awhile the shortest path to success is just a few lines of plain old code.

One should probably strive to become well versed enough that they don't fall into the trap of "If the only tool you have is a hammer, every problem will begin looking like a nail."


Dave


In reply to Re: When to Use Object Oriented approach in Perl? (RFC) by davido
in thread When to Use Object Oriented approach in Perl? (RFC) by thanos1983

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.