Artak Hovakimyan
Web Developer
Clean Code
Clean Code is a term introduced in the book Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. Maybe we have often heard this term before, but do we understand what is meant by Clean Code?
What is Clean Code? Clean code is code that is properly formatted and well structured so that other programmers can easily read or modify the code. There are several reasons for implementing clean code, including to help other people read the code created and to make the code architecture more elegant so that it is easier to see for a long time, modify and develop. In addition, the application of clean code can also save time and costs when having to perform maintenance on the system. There are six points about clean code that can help improve the quality of code:
Efficient comments — comments are only written on parts that require extra explanation and not because the code is written poorly. Good naming — naming variables and functions follows the general and standard guidelines defined for a programming language or framework. Writing simple and effective functions — each function/method does only one thing. Exception handling — anticipate every possible exception with appropriate handling.
Don't Repeat Yourself! (DRY) — there is no code duplication and the program is modular and neatly structured. Layout formatting — applying code formatting rules, applying tools according to the programming language technology used