~/talk

Confident Code

Talkat Cascadia Ruby 2011 · 2011-07-29..07-30· [testing]
slides:none on file

Argues that methods should have four ordered parts so they read like a story: input gathering, work, results, then failure handling. Demonstrates an interface to a Unix ASCII‑art cow utility and applies concrete techniques: to_s/to_a coercion, decorator or SimpleDelegator wrappers, guard clauses, Hash#fetch, and a null object via method_missing. Extracting checks into a bouncer method and small check wrappers removes midmethod digressions, lowers branch complexity, and makes the code easier to reason about and maintain.

AI-written summary · about

  1. 0:00Intro
  2. 0:49What is confident code?
  3. 1:46Poor Storytelling
  4. 3:08Source Code
  5. 3:21Cowsay: ASCII art animals
  6. 4:19Timid Code Structure (Annotated)
  7. 4:46Narrative Method Structure
  8. 6:51Dealing with Uncertain Input
  9. 7:01When in doubt, coerce
  10. 11:15Encapsulating the Switch
  11. 11:54SimpleDelegator
  12. 14:43Assertion Method
  13. 14:53Ignore Unnacceptable Values
  14. 17:45Substitute Special Case for nil
  15. 18:54A Basic Null Object
  16. 21:00Use Hash#fetch when appropriate
  17. 21:53#fetch for defaults
  18. 22:33Symbol Default
  19. 24:03Confident Styles of Work
  20. 26:14Extract error handling methods
  21. 27:13Bouncer Method in Use
  22. 27:29Checked Method
  23. 28:37The Final Product
~/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.