Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: When to Use Object Oriented approach in Perl? (RFC)

by davido (Cardinal)
on Aug 01, 2014 at 00:46 UTC ( [id://1095828]=note: print w/replies, xml ) Need Help??


in reply to When to Use Object Oriented approach in Perl? (RFC)

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

Replies are listed 'Best First'.
Re^2: When to Use Object Oriented approach in Perl? (RFC)
by thanos1983 (Parson) on Aug 01, 2014 at 09:04 UTC

    Hello Dave,

    I totally agree with you, there no right and wrong solution. A solution is a solution, maybe at early stages like me the solution might not be perfect or well written but I guess until you master something it will always be like this. Even at this stage I found my self taken the decision what approach to follow. Any solution has positive and negative effects, the programmer needs to decide upon what to choose and what is closer to his needs.

    Thank you for your time and effort to comment on my questions.

    Seeking for Perl wisdom...on the process...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095828]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found