[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Hey, I am Sandi Metz and I am the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,last but one speaker and that means Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you have almost made it.\N[audience laughter] Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,You get a break, there's another keynote Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,if you stay for that – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's really bright up here, I'm going to have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to look at you some. So, yeah, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you've almost arrived. Even those of you who Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,are new have almost survived a total RailsConf Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and so I think we should – let's do this – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,sponsors pay the bills, they do, we're glad. [clapping] Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Thank 'em. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,But even more than that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"human people" organize this conference Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and if you see – this is your job before you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,leave today – find someone in one of those Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,red shirts, and say thank you. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Alright? Let's thank 'em here. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Thank 'em in person. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Going to start my clock, I have about – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I really do have about 40 minutes. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I don't have 500 slides of code this year, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,though, so… it's not going to be that bad. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Yeah, let's just go. So Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm Sandi Metz and I'm really happy to be here Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I have a talk. This years talk is Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about code smells. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This is a term invented by this guy. So Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's really, uh, we did not plan that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I would follow Katrina Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but it's the perfect talk to follow her Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,talk. She just mentioned this guy's name. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This guy's name is Kent Beck. This guy's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Martin Fowler, he's the man who wrote Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,this book, which is the book Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that teaches us to do refactoring. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,They collaborated together on the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,third chapter of that book, and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's like naming things wins and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the name "code smell", the reason why Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you know that term today is because Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of what these guys did back in the 1990s. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Now, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I wrote a book a couple of years ago Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,– before that, I wrote code for 35 years, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I went to my desk every day and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,wrote code – and now, I don't do that. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I teach. I teach classes in Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,object-oriented design. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And in my classes, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I have occasion to ask people Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,if they've heard of code smells Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and just like I suspect all of you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,everyone in my class always says Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Oh yeah, we know what code smells Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,are." And then I ask them Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to list five… Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and no one can. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Alright, okay, now I can hear Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you trying, but really most of you cannot. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I know that, okay. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And so, we all think Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,we know about this term Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but it doesn't mean "I don't like your Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,code and I can't tell you why." Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,That is not what a code smell is. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,There is some opinion involved Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but really, it's not just that I Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,disagree with how you wrote your code, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the standard is higher. These smells – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,these 22 different smells all have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,very precise meanings… Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and the power, the magic if you will Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of this list is they've given things Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,names. Once you've given a complex idea Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a name, if we could just Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,learn what that name stood for Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it means we could just talk to each other Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in an unambiguous way without Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,having miscommunications. And so Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,one of the things they talk about – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,very often when people talk about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,code smells, they prefix "code smell" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,with the word "bad". Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,They say "bad smells". Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,But really, the definition of a code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,smell is that it might indicate a problem. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,You don't have an obligation Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to filter out all the smells, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and it's actually important that you not. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's also worth getting familiar Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,with code smells because they have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,such great names. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Look at this list. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Feature Envy" – that's cool. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I like this one, the one that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,needs a code of conduct: Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Innappropriate Intimacy". Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Shotgun Surgery", that's another Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,favourite. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And so, the problem with this list Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,– first of all, okay, I'll confess – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I had that book for a really long time Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,before I read it. I had a really Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,hard time with it. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's one of those books that's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,like a recipe book and I've heard Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,people who – it would be like reading Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a cookbook if you did not eat. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And so I really need the story Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,arc and I had very hard time Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,following along, like, persisting Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,with a bunch of recipes that were just Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,like etc., etc., etc. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,But it turns out Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it was really worthwhile Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I finally did it and actually Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Katrina made me. I have to say it. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Katrina made me. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So there's 22 things on this list. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I had a Stack Overflow at 22. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It turns out there's a guy who's name Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I can't pronounce – "Mäntylä" – it'll Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,be in the credits, he wrote a paper Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,where he grouped 'em. He grouped Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,'em in five different categories, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and through the magic of keynote, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I can do that. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This is the only reason we make Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,talks, so we can use the effects. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So here, let's just talk about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of things that just do not need Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to be that big. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Long methods and large classes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,are probably self-explanatory. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Data Clumps is where you have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,two or more pieces of data that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,always appear together; pass 'em Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,around and in together. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Long parameter list is obvious. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It might only occur once, but if Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's long enough, there's probably an Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,object in there somewhere. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And this other wonderfully named Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,thing called "Primitive Obsession", we saw Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,an example of that in the talk Katrina Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,just gave. This is like when you have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,an instance of a base class Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,like a String, or a Number, or a Hash Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or an Array, and you pass it Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,around to a bunch of objects Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and they look at it and decide on what Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to do based on something that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,they know about it. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So you say, "I got a number, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's six so I'll do thing X" or Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"it's eight, I'll do something else." Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,If only the thing you got was Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,smarter, you could just send Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it messages, so Primitive Obsession Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is when the objects are too dumb Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that you're passing around. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,These things are grouped into Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a category called "Bloaters". Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,They make code bigger than it needs to be Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in the places where they use them. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,The next group, this one, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,these are ideas that are available in Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,object-oriented programming that you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,can misuse. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Switch statements, you know they're Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,conditionals in normal people talk. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Refused Bequest" is when it's an Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,inheritance problem. You have a subclass Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that overrides a method that it Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,inherits from a superclass, and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,throws an exception and says Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,like "I don't implement that thing." Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"I refuse the bequest." Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Alternative Classes with Alternative Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Interfaces" is pretty obvious. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,The other thing is the Temporary Field – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's interesting that Temporary Field is Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,on this list, right? Temporary Fields can Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,be really handy, but sometimes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,they mean that you should have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,made a method with that name, right? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Why are you giving it a name? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,What is it about the code that you have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now that feels like it needs that name? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And so these things are all grouped Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in a category that he called "Tool Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Abusers". I work on a lot of Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,bikes, I have a garage full of bikes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I'm an amateur mechanic Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which means I have amateur tools Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which sometimes involves a very short Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,wrench, a very long pipe, and a Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,hammer. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I can tell you that it almost always Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,turns out badly if you abuse your tools. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Alright, next. This group Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,this is stuff that makes change hard. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So "Divergent Change", "Shotgun Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Surgery" – which we've talked about – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Parallel Inheritance Heirarchies" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which is pretty obvious – sometimes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you have a couple of heirarchies Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that each have two sides, and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,every time you change something Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you gotta go add or move Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in both sides of the heirarchy. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,These are the kind of things Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that keep you from wanting Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to change code or make code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,hard to change. Now, notice that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,almost everything that I'm talking Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about… if nothing ever changes, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's probably okay. Like, code that's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,– really embarrasing code – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's fine to keep that really embarrasing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,code, you should be brave about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,your ugly, embarrasing code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,because it is not costing you money Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,if it's not changing. And so, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,just because these smells exist, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you know, sometimes you should Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,just, like, own 'em. Be proud. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Walk away. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Don't let people make fun of you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,for having bad code. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This next category… Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Lazy Class", "Speculative Generality" – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,okay, on top of the effects Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,finding the pictures is also fun – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,classes that don't do enough is a Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,lazy class, it doesn't justify its Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,existence. I'm going to skip Speculative Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Generality for a minute. Data Class, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you know, we're object-oriented Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,programmers, classes oughta have data Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and behaviour. Duplicated Code is Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,pretty obvious. Let me go back to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Speculative Generality. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm going to ask you to raise your hands Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,again. Who in here has ever Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,written some code for a feature you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,thought might arrive in the future. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Keep your hands up for a minute. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Alright, I'm going to out myself Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,with you here. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Who in here has ever, after many Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,months of working around that code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,ripped it out and thrown it Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,away? {\i1}chuckles{\i0} Yeah, okay. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,We are bad guessers, and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you know, I love OO, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I love object-oriented design, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it's a thing that really interests me, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but this thing of Speculative Generality, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,where we say, I'm going to do something Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,really cool in my code for some feature Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I {\i1}think{\i0} we might need later… Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,this is why people say bad things Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about OO. Right? This is what Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,they blame us for. It's primarily Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,things in that category. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,You have to be right. The few times Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that you are right have to {\i1}really{\i0} Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,be big wins that way the enormous Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,cost of being wrong – code is read Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,many more times than it is written. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,The reason why we cost money Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is the time spent reading code. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And if you add generality, you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,increase the level of abstraction Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of code. Very often that means Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,adding levels of indirection Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which humans are terrible at Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and every time you look at that code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it means its harder to understand. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So we should really try to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,restrain ourselves, and not speculate Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about the future. When the new Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,requirements come in, they'll tell us Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,how we wish we'd written the code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and we can do it then. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Dispensables. Sorry, here. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Ah, see I did that thing with the clicker! Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Dispensables, okay, you've all Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,seen that now so we'll move on. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So the last category here is this group. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Feature Envy", "Inappropriate Intimacy", Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"Message Chains", and "Middle Man". Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Feature Envy is when I have an object Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,uh, Joe down here is an object, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Joe's an object that I know about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I send him way more messages Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,than I send myself. Could be Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that I'm more tightly coupled to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Joe than I know, right? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Inappropriate Intimacy would be Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,when Joe had a bunch of private Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,methods and I reached in and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,got them, okay, that would be bad. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}laughs{\i0} I really am sorta pushing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the code of conduct, aren't I? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I hope no-one was made uncomfortable Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,by that. Message Chains – there's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the Law of Demeter, those violations Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,right? You got dots. You send Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,messages to something you know about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and you get a response and you send Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a message to that. If the types Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,change across those dot changes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that's a Message Chain. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Middle Man is if you have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,an object that you send messages to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and it's sole purpose in life is to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,forward those messages to somebody else Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,maybe you don't need that object. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,These things are grouped together Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in a group called "Couplers" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,because the effect of this Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is that it binds the objects together Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,such that even if they're Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,beautiful, even if you've tested Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,'em, even if they're little Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,works of art, you can't ever Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,reach in and get one out Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and use it in another context. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,They come as a bundle, all or nothing. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And so there you go. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,10 minutes and 34 seconds Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,everything you need to know about Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,code smells. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Okay, but we're not done. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Now I'm going to talk about refactoring Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but not very much Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,because you just heard a talk Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,on refactoring. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,But there's a thing here Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that people don't know, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that those guys discovered in the 90s, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that I want you to go away today Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,understanding, and it's this: Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,refactorings, just like code smells have Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,names and they mean very specific Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,things, refactorings have names Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,they're very specific, and they Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,come with recipes. Not hand-wavy Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,recipes, very, very specific, concrete Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,recipes. Here's one. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This is page 149 of Martin Fowler's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,book, and it looks like a recipe, right? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It has numbers down the side. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,There's little optional clauses here Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,for situations that might be different in Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,your case. You notice that it refers Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to other recipes, here where the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,things are in capital letters, that's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,another whole recipe by itself. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's recipes and recipes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,within recipes. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,All of the refactorings work in the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,same way. This is not something – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,we don't wave our hands and say Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"go refactor" – refactoring has a Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,very specific definition, it's to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,rearrange code without changing its Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,behaviour and all the ways Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in which you can rearrange code are Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,already written down, with instructions Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,by people who really thought a lot Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about this. And so now you know Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,code smells have names, and they're Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,real things, and refactorings have names Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and they're real things, and they Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,come with recipes. I can give you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,one last bit of news. Every code smell Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,maps to the Curative Refactoring Recipe. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Ponder that for a minute. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,What does that mean? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Here's a cheat sheet. This one's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,provided by the guys at Industrial Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Logic. Notice at the top that the code Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,smell they're talking about is Data Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Clumps. This is a little tiny definition Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of a Data Clump. "[F 81]" is a Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,reference to page 81 in Martin Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Fowler's book. The three things Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,on the bottom are the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,refactoring recipes that are curative Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,for that code smell. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So this slide, I just blew it up Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so you could see it, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I just extracted it from this PDF Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which is a couple pages long. It Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,cross-references all the code smells Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and refactorings in Martin Fowler's Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,book and also a book by Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,another guy named Joshua Kerievsky Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,called {\i1}Refactoring to Patterns.{\i0} Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It turns out that this is all Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you need to know. The problem Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is solved. You do not have to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,reinvent this wheel. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,All you need to know is a few things. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,And many of you – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,at least, my experience – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the reason I wanted to give this talk Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,from my experience teaching is Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,somehow a generation has passed Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,since all these books were written, and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that people new to programming Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in the last 15 years – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm a woman of a certain age, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you can tell – Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,if you're new in the last 15 years Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you may not have this information. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm going to show you some code now. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm going to use the last 15-20 minutes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,looking at code, and I'm going to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,show you the practical effect of Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,recognizing code smells and doing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,refactorings. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,My class Sale is a subclass of Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Persistence. You can think of that as Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,ActiveRecord. If you're in the back it Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,won't hurt my feelings if you get up Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and come forward – that's the font Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,size of my code. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I didn't know I was gonna be in the Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,keynote, man, it just happened. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Let's say I have my class Foo that has Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a sales_total method, takes some params, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and maybe this a controller-like thing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or something that a controller calls. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It knows the name of the Sale class and Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it knows some other things, right? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It knows that Sale understands where Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and it knows that the thing that comes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,back as a response from sending the where Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,message knows sum.