~/talk

Law of Demeter: A Practical Guide to Loose Coupling

Talkat CppCon 2021 · on Monday, 2021-10-25· at 11:00· online· [frontend-architecture]
links:none on file
slides:none on file

Shows concrete C++ examples that break and fix the Law of Demeter and claims applying LoD plus Single Responsibility and Dependency Inversion yields code that’s easier to change and test. Demonstrates constructor-based dependency injection, use of strong types and Concepts to catch mistakes at compile time, compares type erasure, std::variant and std::any tradeoffs, and wires objects in a composition/factory layer. Provides fakes and BDD-style tests as proof that the refactor makes the code looser coupled and more testable.

AI-written summary · about

  1. 0:00Introduction to loose coupling
  2. 0:33Motivation for better design
  3. 1:36The essence of good design
  4. 2:52Why tight coupling fails
  5. 5:43Anti-patterns to avoid
  6. 7:01Analyzing bad code examples
  7. 9:28Common software problems
  8. 10:38The Law of Demeter
  9. 11:55How to fix tight coupling
  10. 13:32Applying TDD and SOLID
  11. 14:38Solid vs. Stupid principles
  12. 15:52Single Responsibility Principle
  13. 19:36Dependency Injection
  14. 22:54Constructor injection tips
  15. 24:53Pitfalls of Dependency Injection
  16. 27:17Managing object creation
  17. 30:15Refactoring chains of calls
  18. 31:43Strongly typed APIs
  19. 33:33Benefits of strong types
  20. 35:33Dependency Inversion Principle
  21. 37:18Polymorphism in C++
  22. 39:31Type Erasure and std::variant
  23. 41:41Injecting polymorphism
  24. 43:27Templates and Concepts
  25. 45:16Functional programming approach
  26. 47:57Choosing the right abstraction
  27. 48:58Refactoring example walk-through
  28. 50:33Separating creation and logic
  29. 52:03BDD and testing examples
  30. 53:46Summary and takeaways
~/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.