January 28, 2024
In his talk, Jonathan Vila tells us the story of Kleen (a clean developer) who fights Poorqe (the dirty code monster), and how to weaponize us to fight such monsters in our daily work.
1) cost of poor quality code: 2 trillion dollars in the US, 4 days a month by developer on fixing errors
2) fixing bugs is 607Billion dollars,
3) clean code principles:
- consistency: formatted, conventional, identifiable
- adaptability: focused, distinct, modular, tested
- intentionality: clear, logical, complete, efficient
- responsibility: lawful, trustworthy, respectful
4) most detected issues:
- high cognitive complexity
- unused code not removed
- remainings TODO
- raw types
- use of generic exceptions
- null handling
- security issues
5)security: https://cheatsheetseries.owasp.org
6) Tools: PMD, sonarlint, checkstyle, sonarqube, findbugs
SonarLint and a pre-commit git hook ftw
Code is going to die, after 5 years only 37% of old code remains, so do not remove all today but clean as you walk!