I would like to share my knowledge about clean coding practices in the software development.
Everyone can do the coding but we are not sure whether it’s a quality code or professional code, it become a habit of writing a clean code, programming is not only solving the problem but its telling what is the way we are choosing to solving the problem, is that aspects clean coding is playing one of the major role in the software development.
In my point of view clean code should bring the following points.
- Other developers can understand what we have written.
- Extendibility.
- Avoid duplication.
- ……
- …..
Simple example
The above is doing the addition operation, it should work but it’s not professional coding practices, I have to ask few questions like what is a, b and Do? and so on.
What about this code? Everyone can easily understand what it is doing and so on, so this is one of the ways of writing the clean code.
Always we have to keep in mind the following things while writing the coding.
- Proper naming (class, methods, members, properties and so on).
- Documentation.
- SOLID principles.
- Think about future.
- Write unit tests.
- Refactor if it’s not readable.
- Put the classes in the proper namespace.
- Consistency
- Culture independent.
- Machine independent.
- Easy to configure the system.
- Memory leaking issues.
- Think about performance issues.
- Error handling
Those points are very important and it’s not enough to write the professional code, we need to learn more about best practices and defining rules within the team and develop a code.
Conclusion
Initially it will be hard to follow all the points, but once love this and practice it, it will come naturally and you will become great professional developers.
ALL THE BEST