Code Smells - Hall of Fame
summary
Practical rules and gotchas: keep methods under 20 lines and call-depth under three, aim for files ≈200 lines in Java, and avoid blind DRY refactors that couple flows. Concrete warnings: bad names cause most bugs, wrap primitive IDs into microtypes (customerId vs long) to prevent mixups, immutable entities break Hibernate and immutable lists can explode memory (one example allocates ~400MB for 5,000 adds). Prefer streams over side‑effecting for‑loops, avoid reduce in Java, use IntelliJ/ErrorProne hints, and delete unused code by logging then removing if unseen.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:20Code smell warm-up
- 3:38Understanding code smells
- 5:45The importance of naming
- 8:40Methods and classes
- 10:57Modeling with new types
- 13:59Feature envy
- 15:47Data classes and delegation
- 17:32Primitive obsession
- 19:35Functional programming
- 22:13Immutability challenges
- 24:26Builders and modeling
- 26:43Reassigning variables
- 28:36Loops and streams
- 30:13Abusing streams
- 32:54Functional principles
- 36:00Error handling
- 38:44Returning behavior
- 40:32Dead code
- 42:32Conclusion and community








