Steps to take to make code understandable

Hi,

What steps can we take to maintain code. I had a programmer who made some iphone apps and php web apps. Now hes left the job and I can’t understand how the code was written and the logic behind it. What steps can I take to take care that this does not happen in the future.

One obvious thing that I thought of was comments in the code. What other steps can I take to make sure that anyone who reads the code understands it. What are the standard practices? What processes do you follow for this.

Thanks!

Use field names in the code that describe what those fields are for and function names that describe what the function does. Your code should then be mostly self documenting.

a book related to what you’re asking about: “Clean Code” http://amazon.com/gp/product/0132350882

Self documenting code + certain comments can go a very long way, but the person reading the code also needs to be reasonably skilled, and possibly familiar with certain specifics.

Thanks for the replies guys.
Do you guys make a sort of a README file for each program that you write? And how do I maintain conventions for PHP? Is there any online guide for this?

If the application is intended for adapting (for example if it’s downloadable) then yes I would provide a manual or specification for the product to explain how everything works, talk about all the stuff that needs to be mentioned and point out how the code works and what can be tweaked (along with the values it should hold). It makes more sense than code commenting if it’s going to the web as you’ll save GB’s in bandwidth. :slight_smile:

Thanks for the replies!