~/talk

Clean Code: Applying Object Oriented Principles

Talkat RubyFuza 2014 · 2014-02-06..02-08· [ruby, software-architecture]
slides:none on file

Claim: most conditional switches belong in factories and can be removed by modeling behaviors as objects. Uses Ruby to refactor examples: a bird type string becomes AfricanSwallow and EuropeanSwallow classes; an arithmetic expression evaluator splits a monolithic Node into ValueNode, AdditionNode, MultiplicationNode plus a BinaryOp abstract class, eliminating all conditionals in evaluation and to_string while preserving results; a boolean verbose flag becomes StandardLogger vs VerboseLogger. Outcome: code is easier to test, extend (add unary sign node) and follows open/closed and SOLID principles.

AI-written summary · about

  1. 0:00Replacing conditionals
  2. 1:54Simple object refactoring
  3. 3:45Tree modeling for logic
  4. 15:13Polymorphic logging
  5. 19:06Q&A and closing thoughts
~/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.