Hi guys, this time I want to share 25 clean code tips that can be helpful:
- Format your code
- Structure your solution well
- Use proper naming convention
- Use OOP Principles in your code
- Write short methods (20-30 lines)
- Removed unused and duplicate code
- Meaningful names
- Avoid returning NULL
- Keep class size small
- Don’t reinvent the wheel
- Use appropriate tools/IDE
- Avoid catching generic exceptions
- Don’t put everything in a single class
- For simple if-else use ternary operator
- Avoid deep nested conditions and loops
- Use version control for code maintenance
- Don’t use too many parameters in methods
- Use async/await for better user experience
- Unit test and test code after code reviews
- Try expression bodied method (if possible)
- Eliminate extra functions
- Choose your libraries wisely
- Only add necessary comments
- Follow coding and design principles
- Use version control for code maintenance
Don’t forget to check my previous post
25 Clean Code Tips