~/talk

If Statements are a Code Smell

Talkat PyCon US 2020 · 2020-04-15..04-23· [developer-experience]
slides:none on file

Claim: if statements are a code smell when duplicated or deeply nested. The talk refactors an open source Busy Beaver Slack bot that calls the GitHub API with the requests library, replacing scattered if/elif blocks for commits stars PRs and issues with polymorphic EventList classes. The refactor leaves only two guarded ifs in a driver class, simplifies tests (adding one new test instead of changing many), and shows when the rule of three and guard clauses justify the extra abstraction.

AI-written summary · about

  1. 0:00Intro
  2. 1:29What is an if statement
  3. 9:58Generating summary text
  4. 15:29Objectoriented programming
  5. 16:48Objectoriented principles
  6. 19:28Polymorphism Example
  7. 19:56Python Example
  8. 21:00How to Replace Conditionals
  9. 21:33What is this bot trying to do
  10. 21:56How we would refactor
  11. 22:25Creating a base class
  12. 23:48Creating a driver class
  13. 24:41Adding new functionality
  14. 25:02Creating a class
  15. 26:00Refactoring
  16. 27:51Composition vs Inheritance
  17. 28:50Recap
  18. 29:46Busy Beaver
~/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.