Quantcast
Channel: Philip Llaycock's blog
Viewing all articles
Browse latest Browse all 2

Avoid Headaches - Comment Your Code!

$
0
0

As a web developer, I am often making updates and changes to websites that were coded by a previous developer. Most of the time, pre-written code is easy to follow, but then there are other times when it is like trying to decipher ancient hieroglyphics. Knowing the basic core concepts of the programming languages is a bonus, but it is sometimes not enough. A well commented code helps me the most when narrowing down the meaning and intentions of the code in play. It also helps me become more efficient so I can spend less time trying to crack the code and make the necessary changes needed in a reasonable time. I find that well commented code is like a diagram of how the code is structured and why it is important to the site it powers.

Commenting code is a benefit to others and a huge benefit to you. It doesn’t take a lot to comment code so other programmers can see what the flow of your intentions are. Many times code can be quite intricate in design and it is often easy to forget why you structured certain functions, or other elements, the way you did. Well commented code can jog your memory and will have you saying, “Oh yeah, that's what I'm doing here.” The comments do not have to be highly elaborate, just writing something meaningful is sufficient enough to get the main points across.

 

Most, if not all, programming languages have special key characters that denote comments for the user to read and that the program itself will ignore. Below, I have listed characters of code I use most as well as a couple of extras. 

 

A lot of the above examples share the same special characters for inserting comments into your code and don't require a lot of work.

As you can see, it is rather easy to markup your code, which in turn makes it easy to work with when you revisit it.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images