Tuesday, November 30, 2004

Deleting code

Just encountered a nice post titled Deleting code by Ned Batchelder. I mostly share author's attitude toward the subject so there is no point to argue. Just have a small addition regarding the code you wrote as experimentation or in anticipation for something and then discover that YAGNI. In this situation I often found myself not simply delete this code but move it to some temporary file instead.

By convention, this file is often called scratch. or just x. Here are the various code snippets that were purged from the production code or even never managed to get there got accumulated over the time. I found it easier and simpler to look through this file than to rely on SCM.

3 Comments:

Blogger Alexander Belchenko said...

Hi!
I'm also like this article. I think from this point must be followed conclusion: if you're write some experimental code -- the best way is use branching in version control. Clear source code without commented code inside is best way to obtain maximum productivity.

BTW, I'm work on translation of this article to russian. If you interested in -- e-mail me. I'm in Zaporozhye, Ukraine.

12:49 PM  
Blogger Alexander Belchenko said...

bialix@ukrpost.net

12:57 PM  
Blogger Max Ischenko said...

In general, yes, branching is the way to go. But sometimes it just not worth it. Even with a sane SVM like Subversion the hassle associated with branching can easily overwhelm the potential benefits, esp. if the code snippet in question is rather small.

Therefore the trick I use.

1:07 PM  

Post a Comment

<< Home