YouTube home Comedy Week on YouTube
Upload

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

GoogleTechTalks GoogleTechTalks·1,782 videos
146,978
126,048
Like     Dislike 23

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to like GoogleTechTalks's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to dislike GoogleTechTalks's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to add GoogleTechTalks's video to your playlist.

Uploaded on Dec 4, 2008

Google Tech Talks
November 20, 2008

ABSTRACT

Is your code full of if statements? Switch statements? Do you have the same switch statement in various places? When you make changes do you find yourself making the same change to the same if/switch in several places? Did you ever forget one?

This talk will discuss approaches to using Object Oriented techniques to remove many of those conditionals. The result is cleaner, tighter, better designed code that's easier to test, understand and maintain.

Speaker: Misko Hevery

Loading icon Loading...

Loading icon Loading...

Loading icon Loading...

The interactive transcript could not be loaded.

Loading icon Loading...

Loading icon Loading...

Ratings have been disabled for this video.
Rating is available when the video has been rented.
This feature is not available right now. Please try again later.

Top Comments

  • neurosearch

    I'm getting tired of listening to such bad excuse for not writing clean code, maybe your co-workers should find another job instead of complaining about learning something new (it really isn't new, just something you don't learn detailed enough in school)

    Have you ever tried to make a review or maintain an if/ switch - that just got bigger for each new feature?... that is not funny!!

    · 11

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate neurosearch's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate neurosearch's comment.
    in reply to CptSupermrkt (Show the comment)
  • Jonothan Farr

    @Hax0rPr0n You're completely missing the point of the object oriented method and in particular an OO principle called the Open Closed Principle which states that software modules should be open for extension but closed for modification. This property allows us to add capabilities to a software system by adding new modules (i.e new subclasses) without incurring the risk of changing existing code. That's the main reason to favor inheritance over conditionals, it has nothing to do with clarity.

    · 6

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Jonothan Farr's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Jonothan Farr's comment.

All Comments (129)

Sign in now to post a comment!
  • Amir Halperin

    Another great talk from Misko Hevery.

    10x

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Amir Halperin's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Amir Halperin's comment.
  • Shockszzbyyous

    why wouldn'tyou write code that is easier to read and is cleaner ?

    there is just no reason to not do it ...

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Shockszzbyyous's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Shockszzbyyous's comment.
    in reply to neurosearch (Show the comment)
  • Nikolaii99

    i'm a complete noob... so i'm trying to learn how to organize my programs/applications into a collection of classes... and wrap my head around object oriented programming... i think this was helpful for understanding polymorphism (even to a beginner)... And it really makes me think about different ways to go about coding... The only thing i didn't understand was Guice... i'll have to look it up and learn more about it.

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Nikolaii99's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Nikolaii99's comment.
  • allyourcode

    re expression modeling interview question: bonus points for visitor pattern :P

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate allyourcode's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate allyourcode's comment.
  • allyourcode

    What about laden vs. unladen swallows? How can I effectively model that with single inheritance?

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate allyourcode's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate allyourcode's comment.
  • peng yu

    eval can save the operator subclass! Kind of java person would do this...

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate peng yu's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate peng yu's comment.
  • duncreg

    Sounds like there's something wrong with the language you're using.

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate duncreg's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate duncreg's comment.
    in reply to neurosearch (Show the comment)
  • Tetteh Sackey

    you still need to check the operator and new up the appropriate subclass so, how are getting rid of if statements? am i missing something?

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Tetteh Sackey's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate Tetteh Sackey's comment.
  • azbiza

    this was refreshing, ty

    ·

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate azbiza's comment.

    Sign in to YouTube

    Sign in with your YouTube Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to rate azbiza's comment.
  • Loading comment...
Loading...
Loading...
Working...
Sign in to add this to Watch Later