I don't KISS, but I like to keep it DRY.

If you didn't get past the disgusting interpretation of that title, then you probably shouldn't be reading this blog ;)
I make elephants out flies and flies out of elephants, after-all, the human genetic code is 40% bananas!

Sunday, April 4, 2010

The rules of replace all

The following is a list of rules I believe one should follow if one ever thinks of using the 'replace all' feature in a text editor/IDE. All rules are equally important, except the first one which is more important than the rest.

  1. NEVER REPLACE ALL.
  2. NEVER replace all on something you didn't write.
  3. Perform a cost/benefit analysis each time you dare to think of using 'replace all'. Replace manually if there is ANY COST AT ALL.
Also, if you're implementing 'replace all' in your own text editor - do it on the entire document AND NOT  from the cursor's position to the end of the document, becuase then it's a 'replace all from cursor to end', not a 'replace all' feature.

No comments:

Post a Comment