~/talk

Identifying Common Code Smells

Talkat C++ on Sea 2022 · 2022-07-05..07-07· [software-architecture, c-and-cpp]
github:arnemertz
slides:none on file

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

  1. 0:00Start
  2. 5:42Example code
  3. 6:54Long function
  4. 20:41Premature generalization
  5. 24:44Deeply nested control flow
  6. 45:42C++ Smell: missing algorithms
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.