Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Over Programming

by little_mistress (Monk)
on Apr 26, 2000 at 00:15 UTC ( [id://9099]=note: print w/replies, xml ) Need Help??


in reply to Over Programming

OH yes the regular expressions i commented out did do something if the found a match.

Let me give an example:

When the user entered text into one of the text areas that was parsed by these regular expressions it would find any metacharactors and insert a perl escape charactor in frount of them. This is to alow a user to use metacharactors when naming something, if they so choose. Lets imagine for the sake of argument that a user wanted to use an equals sign "=" in the id of an object that the web interface allows them to configure. In the config file you would end up with something like this:

filterid = id\=5

All well and good however when it was read back from the configuration file and displayed in the UI ... it continued to show up as "id\=5" rather than "id=5" due to perl's wacky interpolation rules. Which, in this case, the programmer was working against not with.

Now, when it came to debugging the problem with what perl was giving to the UI I first had to determine if we really neaded the metacharactors to be writen to the configuration file with a perl escape charactor. From all my experience you don't, however in this case perl was putting together html pages full of javascript that were being spit out to a browser. There was the possiblity that the escape charactor was ment to be aliteral slash in perl and an escape charactor in the javascript it was writing. Not the case, as I found out when I totally commented the regular expressions out and not only did the bug dissapear, but no new bug was added. By removing totally the three lines of code and not replacing them at all with anything solved the problem.

When I finally sat down and talked the the original developer about this a 20 minute discussion of how making sure that you handle metacharactors is importaint, silly girl go back to your cube. (thats alittle unfair of me to say, I'm well respected here.) But no lie it took 20 minutes to convince this fellow that overcoding was causing the problem. I showed him on his copy of the software on his workstation we came back to my cube and I showed him on my installation, we went to the lab and installed a build from one month ago and I showed him that the solution worked there. I grant that erroring on the side of caution is the way to go, however, that doesn't always make for sane code.

Perl, due to its forgiving nature, I think is more prone to over coding than C, Java, Corba, Python ... the list goes on. It seems to be the case that over coding is a bug in the progam, caused by a bug in the programmers. ;-)

little_mistress@mainhall.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found