Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by sundialsvc4 (Abbot)
on Aug 01, 2014 at 03:10 UTC ( #1095837=note: print w/ replies, xml ) Need Help??


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

Bottom line for me is ... I happen to find “the object-oriented approach” to be damned useful!!   :-D

And here is why:   “because you always know precisely where your data is!”

Q:   “Exactly what piece of data is this piece of code supposed to manipulate?”
A:   this

Instead of treating “executable statements” and “the data which the statements are to affect” as two separate things, the object-oriented paradigm makes things very, very easy:   whenever your executable subroutines are invoked, “the piece of data that they are intended to manipulate” is implicitly known.   You don’t have to monkey-around with “passing ‘the right thing,’ everytime and everywhere” to them, as procedure/function parameters that you must take care to provide “correctly.”   Instead, the language itself does this for you.

“The language, itself” also shoulders more of the burden of determining whether-or-not these subroutines are “the right subroutines to call” in any particular situation.   Instead of throwing that burden entirely upon you, as the application-programmer, the language bears much of it, through a clearly-defined mechanism of classes and inheritance rules which are easy to understand ... and to exploit.

“Damned useful,” as I said earlier, because it makes my chore easier.

Now, is there an equally-pragmatic down side?   You bet there is!   This crops up whenever you look at a particular bit of source-code ... and you simply can’t tell exactly what it’s gonna do ... and it actually makes a difference.   (Example:   you’re chasing-down a nasty bug, and you run into a fork in the road, and you cannot tell which direction the rabbit might have gone.)


Comment on Re: When to Use Object Oriented approach in Perl? (RFC)
Re^2: When to Use Object Oriented approach in Perl? (RFC)
by thanos1983 (Pilgrim) on Aug 01, 2014 at 09:19 UTC

    Hello sundialsvc4,

    You are absolutely right, I was reading all the time about OO programming and I was not able to understand the abilities of such a coding process. The moment that I created a sample of code, I was so impressed with the result that I am wondering was I was doing so long? How could I have mist something so important. From my point of view OO programming could practically assist a programmer in so many ways that it does not even worth spending the time not measure the performance.

    Thank you for your time and effort reading and replying to my question.

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-09-30 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (385 votes), past polls