
BANDUNG, itb.ac.id – Nearly all companies today use software and computerized systems to automate the resolution of various problems. Unlike building construction or other common tasks, these systems are built using programming algorithms, databases, and designs that are not tangible. When a company wants to expand and develop, the systems that support it must also develop and maintain them. To achieve this, the programming of these systems must be carried out step by step in a gradual and clear manner. One important foundation in building a system is writing code in accordance with applicable standards and conventions. To meet this need, the Informatics Engineering Study Program invited GDP Labs to host a lecture entitled "Clean Code” on Friday (24/03/17) at 14.00-16.00 in room 9009 LFM, Bandung Institute of Technology.
Glance at Clean Code
Clean Code It's a recognized practice in coding, including writing variables, methods, and classes, as well as error handling. While it may seem insignificant, poorly written code has been proven to destroy projects and companies.
Hukum LeBlanc menyatakan bahwa “late equals never", namely rearrangement bad code Late projects will never materialize. This results in code clutter and makes it difficult to add features to the system. Companies will spend a lot of time and money supporting code maintenance and may end up going bankrupt. By implementing Clean Code From an early stage, companies can focus more on adding new features and system updates to develop themselves, rather than maintaining legacy code.
Naming variables, functions, and classes
The names used for variables should reflect what the code does, why it was created, and how it works. Good, unique naming also reveals the intent of the programmer who wrote the code and makes it easier to find variables within a program, making them understandable to others who continue developing the program or system. GDP Labs also emphasizes that each function should be small and fulfill only one purpose: either to do something or to provide an answer to a problem, but not both.
Furthermore, GDP Labs also urges to avoid excessive parameter usage in functions. In object-oriented programming, classes are used to provide attributes and implement behavior for an object. To write clean code, programmers must also pay attention to the order in which a class is declared. GDP Labs also reminds us that each class should be small, have only one responsibility, and each method within it should be highly cohesive.
Pemberian Komentar, Formatting, and others
There are several things to consider when writing code, one of which is commenting. Comments are parts of a program that aren't executed, as their function is to explain the code so that programmers reading it can understand it. The best explanation for a block of code should be the code itself. Clean Code teaches how to improve code readability, eliminating the need for comments. Comments should be informative, explaining the programmer's intent, and reminding the programmer of the consequences of using that block of code.
Another important thing to note is formatting, namely how to place functions, classes and variables according to standards, as well as indentation and alignment GDP Labs also briefly discusses proper error handling and why code rebuilding is necessary.