For those that don’t know, in programing comments are a piece of text that is ignored when the program is run (had to rewrite that about 3 times to avoid using words like “compiler”. If you don’t know what a comment is, a compiler would just confuse you more.). Now you might think: Why write stuff that just gets ignored? Two reasons, both very simple. The first is that you might temporarily comment out a piece of code so that it stops running, useful when you want to disable something without deleting it. And the second reason is: documentation.
Now I am a one man development team, that means I have written all the code (except the base systems unity provides) that goes into my game. As such, I can remember why I wrote a piece of code a specific way fairly easily, taking only a minute or two to re-read a few of the functions. This however means I am a bit… lazy when it comes to adding comments about what things do.
Now I could make excuses about the process being iterative and not wanting to write out an explanation for a line of code that is likely to either change or go away. But the truth is that during the coding process I just forget to write the comments and after I get it working I just move on to the next thing.
That brings us to the solutions for this. The first immediate one is that every now and then I go back in and add comments to my code. A long annoying process that will have to do until I can develop the habit of commenting as I go. The other solution is having other people to work with that can and will look over my code. I know myself, doing something for myself? Sloppy and it just needs to work. Doing something for someone else? Detail oriented, dotting my i’s and crossing my t’s. That extra pair of eyes will force me to develop the good habit of commenting as I go. But that is not going to be a quick process, so for now? Back to adding comments to everything… all at once.