15/05/2023
👧 💻 Eleonora is one of our Tech Leads who has been working at Blubito for five years. Eli manages the development team of a very innovative project in the digitalization field and is responsible for conducting code reviews, making architecture decisions, and providing project and code decisions. As a Backend Developer, she specializes in using Java with Spring Boot and microservice architecture and has experience working with other technologies such as MySQL, Camunda, and Objectif Lune. Additionally, she provides support and mentoring to junior developers daily.
Today she shares some snackable tips and tricks for clean code:
✅ Meaningful Names: It's essential to give meaningful names to variables, functions, classes, and other entities in the code. Avoid using generic names such as x, y, z, a, b, c, etc. Instead, use descriptive names that convey the purpose of the entity in the code. For example, a function name should show us what it does, even without reading the inside of it.
✅ Avoid Large and Complicated Functions: It's crucial to avoid large and complicated functions in your code. Breaking down complex functions into smaller ones makes the code more readable, easy to understand, and reusable. Also, avoid repetition of the code. If the code is repeated, it could be extracted into a separate function.
✅ Avoid Hardcoding: Hardcoding values into the code makes it less flexible and harder to maintain. Instead, use constants or configuration files to store the values. This allows you to change the values without modifying the code.
✅ Well-Written Logs: Writing well-written logs is essential to discover bugs or during debugging. They should also be optimized to not affect the performance of the code.
✅ Avoid Overuse of Comments: If there is a need for a lot of comments in the code, it may indicate that the code is not self-explanatory enough. Instead of adding more and more comments, work towards making the code more self-explanatory. While comments can be helpful, they should not be on every line of the code.
______