When it's time to be sloppy?

time to read 2 min | 232 words

I posted before on the dangers of being overly dynamic in code. The end result of such things is that it's very hard to find what exactly is going on in the code. But there is a high value of using sloppy code to manage tasks you need to do one time only.

For instance, recently I began to use a combination of SQL statements and Regular Expressions to generate batch files / sql scripts that does any number of one-off tasks. It's much faster than do those things by hand, and they are not worth writing something robust to hanle them.

This include cleaning a set of tables from known values, running a spesific set of scripts, etc. It's much easier when you've a certain convention (all files for this table are prefixed with the table name, for example). It make working with the environment much easier, but I found that that while it's fast to do this, it's also very hard for other people to keep track of what I'm doing.

Much worse, it's not easy for me to repeat the same action twice, since usually I'm changing the state that I'm working with. I guess that what I'm saying is that it is a useful technqiue, and it saves a ton of time, but I still don't like it.