top | item 7929786

(no title)

matt__rose | 11 years ago

Never delete code. This is why you have git or svn, or whatever your tool of choice is. Never, ever delete code. You may think it's dumb, you may think it's crap, or useless or whatever, but in 2 years, you'll think. "Damn, I remember doing this already, don't I have some code in somewhere?" And you will.

You may look at it and rewrite huge chunks because you're a far better programmer now, but trust me, re-writing code is way easier than writing it from scratch

discuss

order

daemonl|11 years ago

Yep. I know. I even deleted the github repo. I'm seriously not sure what I was doing. Remove all traces of a bad idea?

mattdeboard|11 years ago

Ouch, why on earth...

Anyway, good blog post.

ulisesrmzroche|11 years ago

Nah, SCM tools were not made to be your personal snippet collector, you're better off just getting a real one if you're the hoarder kind of programmer.

seanmcdirmid|11 years ago

Sometimes you just need to burn the pictures of you with your ex and move on. In some way, you should "KEEP" everything, after all digital space is cheap right? But you can keep a lot of code around that you will never revisit in the future.

> but trust me, re-writing code is way easier than writing it from scratch

Not always true, and not even often true.

randallsquared|11 years ago

> > but trust me, re-writing code is way easier than writing it from scratch

> Not always true, and not even often true.

In my experience, virtually always true. Just rereading the code you wrote before will bring back the understanding you had when you wrote it (unless you intentionally wrote obfuscated code, I suppose?), and it'll be immediately obvious to several-years-on you what the shortcomings were of that idea. If you have the time, a full rewrite almost always turns out to be better code than the old version, as long as you can hold off on trying new experiments in the process.

ascotan|11 years ago

grep -a 50 -b 50 string /dev/disk0 ftw

Dylan16807|11 years ago

I assume you mean grep -C 50. Lowercase a and b are ascii and byte offset rather than lines after and before.