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

Re^4: How do you find keys of a Blessed Hash?

by perl-diddler (Friar)
on Oct 17, 2012 at 16:49 UTC ( #999576=note: print w/ replies, xml ) Need Help??


in reply to Re^3: How do you find keys of a Blessed Hash?
in thread How do you find keys of a Blessed Hash?

That is the point of debugging your code. By reducing your code to a small snippet, you stepwise eliminate all unrelated parts. And usually, if the symptom goes away between two editions of your program, it is highly likely that the part you changed last is related to the symptom.
--- When my code was significantly simpler, that was the case, but having spend enough time in the kernel and in other real-time systems, 9 times out of 10, changing a line of code and seeing a change in behavior were unrelated because the underlying trigger was 1000's of lines away in code that seemed to work perfectly in all other cases.

Case in point was a kernel hang -- would run for up to days w/no problem, then hang, so finding 1 line to change out of 5000 and waiting for days wasn't the most ideal solution for debugging. in fact trying to break apart pieces only led to management thinking that there really was no problem or that the product should be released anyway -- because pieces would work. It was only when all the subsystems were tied together than one subsys relying on annother that called a third didn't release a deeply held lock -- so after the damage was done, only rarely would the locks go that deeply and hit the 'stuck lock'....

I could detail about 10-20 other similar situations, where none of them were simple bugs -- I was given these problems to solve because they weren't easy and couldn't be solved by simplification and simplification was only a waist of my time (not that I didn't try where possible). The one that froze every few days - I optimized the hell out of the code so it froze < 2-3 hours... then finally down to <45 minutes. My manager was pissed at me spending so much time optimizing, but when I got it to happen frequently enough, I was able to catch it in the act and finally solve the problem. Insisted on a full 7-day run-test as proof that the bug was gone...it passed, and I got downgrade my next review for wasting time optimizing the product and requiring too long for testing.

Generally, I've been trying to use perl as a higher order language, but that's when the slightest variance in my understanding and how it really works (right or wrong) leads to big brokenness later on.

Because of such, I try to add in lots of error checking and debug support routines with the result that my programming goes alot slower than most - a recent program in perl of around 2k lines as probably, easily 1k lines dedicated to debugging and error checking -- note I say easily 1k, my gut wants to say about 2/3rds or more went into error checking...boy does that slow down your coding....but it does help in narrowing down the location of problems more quickly, later...

-linda


Comment on Re^4: How do you find keys of a Blessed Hash?
Re^5: How do you find keys of a Blessed Hash?
by Corion (Pope) on Oct 18, 2012 at 07:12 UTC

    Feel free to cite situations and war stories where weird practices have worked for you once.

    Let me just suggest that most of your problems you've shown here are not of the grand scale of highly complex systems interacting weirdly.

    Your problems are because you introduce and keep unnecessary complexity instead of removing it. If you removed stuff instead of adding more, that would help you to spot your problems faster, or at least it would help us to help you in an easier way.

    But again, the stories you tell do not match up with the problems you're having here, or at least the practices you claim to have appropriated from these times do not transfer to the problems you're experiencing with Perl programming. I suggest you try a simpler approach to solve the problem at hand instead of introducing complexity you cannot handle to cater for potential problems later.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-04-18 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (460 votes), past polls