Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Breaking The Rules

by GrandFather (Saint)
on May 30, 2006 at 19:55 UTC ( [id://552617]=note: print w/replies, xml ) Need Help??


in reply to Breaking The Rules

Many of the so called rules are actually guides set out to make your life longer and happier. Sure, you can parse HTML, CSV, ... whatever with regexes. You can write your own regex engine if you want. You'll learn a great deal about regexen, but with respect to your primary goal of parsing some HTML, you are liable to spend a lot of time, encounter a lot of unhappieness and possibly not get the job done.

You don't have to use strictures, but they cost almost nothing and save bulk time. "use strictures" is a guide, but it should have the status of a rule. There are very few times in modern Perl where strictures are "bad", but almost every line of code written benefits from having them turned on.

All the rules (or guides) are of greatest benefit to those who don't understand them or don't understand why they should be followed. So, if you don't understand a rule, follow it!

In summary, don't blindly follow the rules. Follow the rules because we say so, but ask us why the rules are as they are. Understanding why is as important as following the rules, but follow the rules until you know deep in your waters why the rule is there.


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Breaking The Rules
by ptum (Priest) on May 30, 2006 at 20:29 UTC

    I strongly agree with this excellent summary by GrandFather. There is a basic problem with the OP's summary statement, and the update doesn't really correct it:

    In summary, don't blindly follow the rules or be afraid to break them. Think for yourself and make sound judgements.

    The problem is that, without noticeable exception in my experience, any 'hacker' who is tempted to 'break the rules' fails to possess the judgment necessary to evaluate the extent of his or her own wisdom (or lack thereof). Programmers are an arrogant breed, and we are often guilty of overestimating our own intelligence or knowledge base. Saying it in another way, while we may have a pretty good idea of what we know, we are rarely in a position to know the extent of what we do not know. Rules or guidelines are the safety nets of the developing world, which help us avoid pitfalls that we might not even see, or are perhaps dimly aware of. Personally, I suspect that the so-called legitimate reasons for breaking the 'rules' fall into two categories:

    1. They illuminate an ill-conceived 'rule' or a guideline that is insufficiently precise
    2. They illustrate the triumph of the developer's ego over his understanding

    I don't like rules any more than the next guy, and sometimes it irritates me when people spout a generalized version of a rule that doesn't apply to my specific situation. But nearly every major disaster that has befallen me in my programming career has been the result of ignoring one of these best practices.


    No good deed goes unpunished. -- (attributed to) Oscar Wilde

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found