Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Assign Contains RegEx WTF??

by davido (Cardinal)
on May 20, 2009 at 08:27 UTC ( [id://765148]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Assign Contains RegEx WTF??
in thread Assign Contains RegEx WTF??

How does the quote go? "Any sufficiently advanced technology is indistinguishable from magic." (Or something along those lines.)

Anyway, if the point is to write maintainable code, it still seems reasonable to document well enough that the intent is clear. Code comments aren't only for beginners. They also serve to illustrate to future maintainers that "you really did mean to do that." Plus, they will help to save time as someone else familiarizes him/herself with your code. Or is that "h(?:im|er)self"? ;)


Dave

Replies are listed 'Best First'.
Re^4: Assign Contains RegEx WTF??
by JavaFan (Canon) on May 20, 2009 at 10:31 UTC
    Yes, but where do you stop? At the end of that road is:
    $i++; # Add 1 to $i
    IMO, if you have to document the syntax, you should rewrite the code. Now, I don't think:
    ($copy = $orig) =~ s/PATTERN/REPLACEMENT/;
    is obscure. It shouldn't need comments. If you feel you're among novices or bad programmers, still don't comment the code. Rewrite it in baby steps.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-24 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found