Designing a Web page is interesting but doing so for the first time has a lot of scope for coding mistakes. This is perhaps because a beginner is not an experienced designer. Well, the problem is not that such a designer is bound to make mistakes but it is that the designer is unaware of making them. If you as a beginner wish to avoid making mistakes, it is essential to know that you are making mistakes. It is only then you will be able to overcome them. Keeping this in mind, here are top 2 mistakes that you may not know but are making.
Meaningless Variable and Function Names
Right since the time of learning, we are used to writing variable and function names as a, b, nam, and so on. However, these names are not at all meaningful because they do not really say what the variable holds or function does. In practice, your variable or function name should be such that it clearly conveys the reader what value it will hold or what it will do during the execution of the code. With proper unique names, you are less likely to have two functions or variables with the same name at various places in the file. It is fine to have shorter names but do not abbreviate to the extent of losing the complete meaning. Moreover, avoid spelling mistakes and using slang names. In order to avoid these mistakes, it is best to come up with naming conventions.
Inconsistency in Casing and Commenting
One of the common habits of novice designers is to code in a mix of upper and lower case along with commenting in their own style. This leads to inconsistency with the code. If the language you are using is case-sensitive, such an inconsistency can trigger errors in the execution phase. For example, coding a variable name as midName and then referencing it with MidName can trigger an error.
Similarly, in commenting, there needs to be consistency. For example, you may comment one function with the text ‘To return personal details’ and another as ‘Duration between order and delivery date’. This inconsistency, although not risky, can confuse the other designers who may work on your code later. Here, the confusion can arise in case of non-specificity: which personal details and what exactly in duration: number of days or time? Therefore, consistency is the key to unambiguous comprehension.