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?? |
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 Section
Meditations
|
|