~/talk

“Using Types Effectively"

Talkat CppCon 2016 · 2016-09-18..09-23· [software-architecture]
slides:none on file

Argues that C++ features like std::optional (optional<char> has 257 values) and std::variant (char|bool has 258 values) let types express exact state so illegal states become compile errors. Shows refactors: enum+fields → variant of per-state structs for connections, optional for nullable alias, and a phantom-type FormData<Dirty/Clean> that forces calling sanitize to avoid SQL injection. Uses cardinality arithmetic (products, sums, exponentials) and promotes writing total functions and typedriven development to reduce bugs and tests.

AI-written summary · about

  1. 0:00Introduction to types
  2. 1:03Types as sets of values
  3. 3:09Type cardinality game
  4. 8:10Product and sum types
  5. 13:18Algebra of data types
  6. 15:26Modeling state with variants
  7. 17:53Nullable fields and optionals
  8. 18:55Monster AI state modeling
  9. 21:41Types and design patterns
  10. 23:10Designing with types
  11. 24:15Phantom types for behavior
  12. 27:25Total functions game
  13. 36:35Self-documenting code
  14. 38:20Types vs testing
  15. 39:48Algebra with data types
  16. 43:22Goals for well-typed code
  17. 44:13Q&A: Partial vs total functions
  18. 45:41Q&A: Lambda injection
  19. 46:23Q&A: Optional and sentinels
  20. 47:11Q&A: Error handling with variants
  21. 48:57Q&A: Performance trade-offs
  22. 49:22Q&A: Optional and pointers
  23. 51:58Q&A: Business logic changes
  24. 52:41Q&A: Function type math
  25. 55:16Closing remarks
~/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.