Identifying Common Code Smells
summary
Shows concrete instances: a 250‑line SFML "tennis" main and a ~100‑line Qt example that reveal long functions and deeply nested control flow; spots magic numbers, a premature generalization (unused color parameter), and a complicated collision expression that gets replaced by named predicates. C++ issues include const-less getters, raw pointers where missing RAII should use unique_ptr and scope wrappers, and copyable handle wrappers violating the rule of five. Fixes: factor into smaller functions, name booleans, use std::find_if/algorithms or ranges, run profilers, sanitizers and static analysis; refactors improve readability with no measured performance penalty.
AI-written summary · about
chapters (6)
- 0:00Start
- 5:42Example code
- 6:54Long function
- 20:41Premature generalization
- 24:44Deeply nested control flow
- 45:42C++ Smell: missing algorithms
related talks
55mIdentifying Common Code Smells (In C++)
59mC++ Code Smells
54mC++ Common Knowledge
51mTypical C++, but Why?
57mThe Real Problem of C++
50mCore and other guidelines. The good, the bad, the... questionable?
55mC++ Core and Other C++ Guidelines - The Good, the Bad, the… Questionable?
01h 31mClean(er) Code for Large Scale Legacy Applications
