HackerTube

THE VIDEO SHELF · polymorphism over conditionals

"The Clean Code Talks -- Inheritance, Polymorphism, & Testing"

Misko Hevery's Clean Code Talk shows how to use object-oriented techniques such as polymorphism to remove repeated if and switch statements. The result is code that is easier to test, understand and maintain.

Why HN readers recommended it

HN commenters recommend it as a thorough treatment of replacing conditionals with polymorphism and why flags and deep ifs can be code smells.

This is a summary from the source dataset, not an endorsement by Hacker News or the video creator.

Video & recommendation details

Creator / channel
Google TechTalks
Topic
polymorphism over conditionals
Format
talk
Level
intermediate
HN recommenders in dataset
3
HN mentions in dataset
6
Recommendation years in dataset
2009–2023

These counts and years describe the included Hacker News records; they are not YouTube views or the video’s publication date.

From the original HN conversations

Excerpts from the recorded comments. Follow each source for the full comment and surrounding discussion.

  • Google posted a tech talk about this a while ago: [VIDEO] which is more comprehensive than the posted article.

    derwiki on Hacker News · 2009-09
    In Using Polymorphism instead of conditionals when programming
  • I completely disagree with the example given in this blog. I don't have time to give a full explaination but I believe the google clean code talks gives a far better arguement than I ever could. On the general principle I agree that overengineering is …

    VBprogrammer on Hacker News · 2010-06
    In Criminal Overengineering
  • It's not so much the existence of the flag, itself, but rather using an if-statement at the deepest-level of the call stack to conditionally modify behavior. This talk gives a great overview of why boolean flags (rather, if-statements) can be a code smell: [VIDEO] OP's …

    Mr_P on Hacker News · 2022-05
    In Flags Are a Code Smell (2014)

Summaries, classifications and recommendation records are from the HackerTube source dataset. Read about this library and its limitations.