Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Breaking The Rules

by Anonymous Monk
on May 31, 2006 at 21:15 UTC ( #552936=note: print w/replies, xml ) Need Help??

in reply to Breaking The Rules

A rule is usually a summary of a lot of experience; it explains the common cases, not the edge cases.

For example, "don't parse HTML with regexps" is a good idea in general: you can't do a good job of parsing arbitrary HTML with a regular expression.

On the other hand, if you wrote all the HTML yourself, and know exactly what applying a given regexp will do to your HTML, then go ahead and use the regexp if it does exactly what you want.

If you didn't write the HTML, on the other hand, you probably can't reliably predict what a given regexp will do to the meaning of a page. You might need to carefully parse the HTML, determine carefully what sections are which, and only then make your substitution. This is the safer assumption: and so the rule prevents you from making bad assumptions without knowing what you're doing.

Understanding the summary is a good idea; understanding the full history of why that summary was written is even better. You'll learn why the rule was made, who thought it was a good idea, in what context and to what extent to apply it, what the risks are for not following the rule, and when it doesn't make sense to apply the rule at all.

For example, hurricane insurance is often a good idea. But this rule works much better for people living in New Orleans than it does for, say, people living in the Nevada desert.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://552936]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2017-01-23 05:36 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (190 votes). Check out past polls.