If Statements are a Code Smell
summary
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
chapters (18)
- 0:00Intro
- 1:29What is an if statement
- 9:58Generating summary text
- 15:29Objectoriented programming
- 16:48Objectoriented principles
- 19:28Polymorphism Example
- 19:56Python Example
- 21:00How to Replace Conditionals
- 21:33What is this bot trying to do
- 21:56How we would refactor
- 22:25Creating a base class
- 23:48Creating a driver class
- 24:41Adding new functionality
- 25:02Creating a class
- 26:00Refactoring
- 27:51Composition vs Inheritance
- 28:50Recap
- 29:46Busy Beaver








