Coding Practices
This best coding practices are not rules. Those are conventions that software development community has developed to create quality software.
- Commenting
This should follow in smart manner. It is not a good habit to comment every single line in a code. If so it means that the code we wrote is not descriptive. This is a bad practice. We can limit those comment in function wise even only we need to note down some stuff.
2. Indentation
Indentations will helpful to make readable code blocks. There can be many ways of indentations. It will totally depends on the way your team mates follows. Finally what we should see is the code with same indentation style.
3. Grouping
Code blocks will helpful to group particular task. Usually task may contain several coding lines. By leaving small space in between these two blocks it will give a readable code.
4. Naming Scheme
In codes we can see two types of naming schemes. As mentioned in indentations this should match with other developers coding style.
— Camel Case : First letter is capitalized in each word except first word.
— Underscore : Word separation is with an underscore.
These names should reveal the intention of the task. It will save the time in by reducing conflicts of the code. Also should aware not to give wrong information from the name. It will miss lead the reader.
When we are dealing with temporary variables we no need to use full words. We can work with even one character. But if this variables contributes for further applications we have to follow name conventions as mentioned above.
If we dealing with databases those quarries should used in upper case to identify them easily.
Get Shamild’s stories in your inbox
Join Medium for free to get updates from this writer.
5. Dry Principle
This means to the “Don’t Repeat Yourself”. Simply we uses codes to make a task easy. As an example in a web application it has several pages with similar type of headers and footers. So, the exact code should not copy paste in each code. This is because once we have to make a change we need to edit each and every place. We can avoid this by using DRY principle.
6. Deep Nesting
When we are going through the development stage to complete a task, it creates some logic which solve within a deep nested loop. But the issue is if someone who hasn’t idea on this code went through it it will creates a hard time for him. Even the developer could forget what he has done in the code. So, going deeply inside to the nest is not a good practice.
7. Limit line length
As humans our eyes mostly familiar with tall and narrow columns of text. Even in news papers we can see this type of text styles. If our code has very lengthy line which reader has to scroll right and read, this is not a good practice. Currently in new IDEs they notify the limit from a marked margin.
8. Files and folder organization
If we develop a small application this may not affect for us. But when we are working with large projects file locations will creates some conflicts. For this we can use an already developed file structure as well as we can imitate existing file structure in our project.
9. Code and Data
We can separately identify codes and data which we used within the code. Specially in web applications those HTML pages are referred as output data. We can separate those data and code in different file structure.
10. Object Oriented Structure
This structure is mostly used in programming which can use to create a structured program. This can use to represent data which we mostly used in databases. Even though, we no need completely convert procedural structures to the object oriented structures.
11. Open Source Codes
When a large project is going on, the code will make available for developers to get an idea on it. So it should have high level of readability. Then developers can get clear idea about what others have done.
12. Code Refactoring
This is not a case of changing functionality of the code. This only relates with making the code more readable. Even this has not any bug fixing features. Here we clean the code in the way that anyone can clearly understand the code.









