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 mr_mischief (Monsignor)
on Aug 01, 2014 at 13:59 UTC ( [id://1095916]=note: print w/replies, xml ) Need Help??


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

How much is your time worth? Should you spend 15% more time programming something to get a 5% speed increase at run time? How many times will this code run? Will an extra one second saved per run over 3652 runs (roughly once a day for ten years) be worth it to spend two hours of programmer time (7200 seconds)? Will your code run that often? Will it only take two extra hours to write and maintain? Is your time cheaper than that of the computer, or even of the users running the code and waiting that extra one second per run?

In Donald Knuth's paper "Structured Programming With GoTo Statements", he wrote: "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."

Is this one of those 3% times? Likewise, Stephen C. Johnson and Brian W. Kernighan said "the strategy is definitely: first make it work, then make it right, and, finally, make it fast."

Is your code handling the common case? Is it now handling edge cases and debugged? Are you at a point that you have a well-designed, well-implemented, easily maintained program with a runtime that is just too slow? That's the time to start looking at small optimizations, and not before.

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

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

    Hello mr_mischief,

    That is absolutely true, even I that I am beginner I find my self spending maybe way too much time to make the code faster and more efficient. Maybe I should focus more in other criteria and less on the speed.

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-18 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found