Why Commenting Your Programming Code Is Important
Programming is exact. Computers (for the time being at least) only know what you teach them, and only remember what you tell them to. They will not remember why your “func1()” is returning a “thingy” object, and neither will you. 6 months, or a year from now, you will be completely focused on some new project, and you will have to go back to that project, and you will look through notebooks, and thousands of lines and dozens of pages of code, trying to figure out what that function did.
You can make your situation better by using a proper function and variable naming convention. Proper naming conventions tend to be language specific at least, but there are some general rules of thumb. ConvertToCat is a much better function name than convcat for example. All caps are typically reserved for macros / global variables. Leading a function with _ is generally reserved for special cases, (like constructors in C#.NET). My point is that many developers tend to be lazy and abbreviate way too often.
Even with the best naming standards, there is still a need for comments. I was taught in my CS courses to comment every function start and end, arguments, and return values. Proper commenting and standards are especially important if you ever plan to work with other developers on a project. It is better to get in the habit of doing things in the proper way, than to pay the price of being lazy later. I can tell you from experience that you do not want to spend half a day trying to figure out what some function did and why you are using it in a certain way.
1 comment.
PHP Permanently Move A Page »« What is the Future of Artifical Intelligence