Design your code to be grep'ed or searched

Seriously. So that future developers who work with your code can reverse engineer your code.

1.) Store code in flat text files

When you are looking for a variable you want to refactor you should not have to find it in some code stored in a database and if you do it should made very clear where all the code is stored and how to get to it.

2.) Make sure that you use file extensions

For example don't write a PHP command line script and then name the file without the .php extension so that when you run it, it looks like a Unix command. I know you can use #!/bin/php at the top of your PHP file so that it will run at the command line prompt with ./somephpscriptwithnoextension but don't do this. A future programmer might grep for *.php files. When you write code and name variables ask your self, "would this be easy to find with a string search?"

Please for all our sakes!

comments powered by Disqus