It is common, when you explore the code source of any program, to find some lines that are written with particular opening symbols. These lines are written in plain text and seem to have nothing to do with the program since they do not perform any action. In fact, these lines are added by the developers as descriptions and as comments on their codes. The reality is, adding these comments is important for further works on the same programs, whether it is performed by the developers themselves or handed to a freelance web designer Singapore.
The web development in words:
The web development is the process that transforms the designed website into a live and ready to go website. This process requires to know the HTML programming language and an appropriate scripting language, mainly PHP, JavaScript, and CSS. The HTML language is the basic language that comes with tags, the scripting languages codes can be inserted within the HTML code.
The comments and their utility:
To make the codes understandable to others, developers add some lines; these lines are not interpreted because they do not instructions but they are some phrases to explain what you are reading. They are called “comments”. The comments are, therefore, what you need to understand the code flow. They are optional but they are very important. In fact, the comments serve as checkpoints, kind of references to other developers when they try to operate further updates.
Inserting comments in the code lines:
Since the comments are not instructions, inserting them within the code blocks may cause some troubles if they are not inserted properly. In fact, there are some symbols that are reserved for this process.
First method: :
It is possible to insert the comment by using the double slash “//”. This method doesn’t require a closing sign. All that is at the same level as the double slash is considered as a comment and therefore is not interpreted.
Example:
line 01 Some code;
line 02 //Comment (can be viewed in the source file, but never as a result)
line 03 Some code;
Second method:
The comment can be inserted using the “/*” method. In this case, the comment can be written over more than one line, because it has a closing sign which is the “*/”.
Example:
line 01 Some code;
line 02 /*Comment (can be viewed in the source file, but never as a result)
line 03 Comment */
line 04 Some code;
Third method:
This method uses the “<!–” as opening signs and the “–!> as closing signs. Here again, the comments can go on more than one line before the closing signs.
line 01 Some code;
line 02 <!– Comment (can be viewed in the source file, but never as a result)
line 03 Comment –-!>
line 04 Some code;
Conclusion:
Commenting is definitely an important practice that developers should be considering. But, the signs that the comments use are critical. There may be the threat for injections if there is no preventive process, especially when it is about connecting to databases.