RailsConf 2014 - All the Little Things by Sandi Metz

  Рет қаралды 175,295

Confreaks

Confreaks

Күн бұрын

Пікірлер: 98
@RillonDodgers
@RillonDodgers 2 ай бұрын
I come back to this video often because it helps me think of things in new ways
@NatanStreppel
@NatanStreppel 27 күн бұрын
Me too. Been coming back here from time to time for a few years already.
@procsharp
@procsharp 9 жыл бұрын
Definitely the best 40 minutes I spent leaning in the last year
@jeteon
@jeteon 8 жыл бұрын
Never in my life has it ever been such a pleasure to watch someone work with code. I'm a believer in people teaching you things about coding now.
@oyuriteixeira
@oyuriteixeira 6 жыл бұрын
The more tech presentations I see, the more I think this might be the best one so far. Sandi Metz is my engineering hero.
@jjw2844
@jjw2844 3 жыл бұрын
She is the most convincing advocate for object oriented programming I have encountered and I learned a ton from her videos and book. I have really doubted OO programming but she shows that it can start a long relationship with your code that you can maintain and flourish and love. Most of the doubts I have had have boiled down to my experience not finishing and following through with refactors, and opting for faux-o, which as she argues is worse than procedural. She also argues that well written functional code and well written object oriented code are similar, which I find fascinating if true.
@RichardWigley1
@RichardWigley1 10 жыл бұрын
Every talk Sandi has even given is worth listening to - this is no exception.
@askegg
@askegg 9 ай бұрын
I keep coming back to this.
@CardCollectorKing
@CardCollectorKing Жыл бұрын
I’ve watched this numerous times over the past few years and I love it each time even more then before. Sandi is a great teacher and really explains the concepts in a way that makes sense.
@yagosansz
@yagosansz 2 ай бұрын
I have watched this talk multiple times, and I learn something new every time I do it!
@Patrick-hs5bd
@Patrick-hs5bd 10 жыл бұрын
Sandi, that was an awesome talk. I kept thinking about what you'd do next and every time you did something smarter than I would have thought. Like everytime, genius!
@linusfalck-ytter5036
@linusfalck-ytter5036 8 жыл бұрын
Wonderful talk - Perfectly compressed and delivers.
@zentekvideogames3589
@zentekvideogames3589 4 жыл бұрын
I came here thinking there's no way I'm watching the whole 40 mins yet they went by real quick. Awesome talk. Only minus, she didn't know about WoW!
@BeALeaderAndAnInspir
@BeALeaderAndAnInspir 4 жыл бұрын
This talk is just phenomenal. Thank you Sandi and Confreaks for your great effort...
@berniechiu
@berniechiu 4 жыл бұрын
Still a masterpiece today
@paulzupan3732
@paulzupan3732 2 жыл бұрын
I actually came to this talk after watch Brian Will's video on how OOP is embarrassing, and I felt like in order to get the full value of that video I needed to watch this. To be honest, Sandi is great fun to watch and she killed it.
@davidmcdonald7506
@davidmcdonald7506 6 жыл бұрын
One of the better talks I've ever seen.
@brianminard2109
@brianminard2109 7 жыл бұрын
Really liked the way the examples are laid out in this talk. One of the most compelling arguments I've seen in favour of delaying abstraction in favour of duplication.
@yugi6209
@yugi6209 9 жыл бұрын
Stumbled upon this from a reddit post. Super-awesome that I have learnt the OOPS objective refactoring. This helped me to move the complex logics, calculations and assignments from the case when block with objects.
@mastodans
@mastodans 7 жыл бұрын
This is so well done. Thank you for sharing these wonderful lessons!
@olivbn6812
@olivbn6812 4 жыл бұрын
This lady and Brian Will discussing programming would be the single most epic battle of the century.
@pushparajbadu1115
@pushparajbadu1115 7 жыл бұрын
Man, I have exact same problem, now I am confident enough to refactor it, Thank you very much Sandi.
@ChristianLeovido
@ChristianLeovido 6 жыл бұрын
I have just watched the first 3 minutes and that got me motivated to refactor everything
@slowresonance
@slowresonance 2 жыл бұрын
15:01 "duplication is far cheaper than the wrong abstraction"
@jhoylangoncalves3127
@jhoylangoncalves3127 7 ай бұрын
I'm not gonna lie, I have 3 years of OO experience with Ruby, that's the third time I'm watching this video and I'm still learning.
@xixiaofin
@xixiaofin 6 жыл бұрын
Think about how much time she spent on preparing all those slide.. this is a superb talk!
@TheSatyam182
@TheSatyam182 9 жыл бұрын
So coding thought process awakening.....Sandi is like programming 'Tomb-Raider' killing bugs :)!
@adm3333
@adm3333 3 жыл бұрын
Such an amazing presentation with many important concepts effectively communicated, but... She does actually introduce multiple bugs into the code because she trusted poor quality existing tests. It's possible for quality to go infinitely negative for normal items and for it to get to 51 for Aged Brie. So take that as a lesson in placing too much trust in existing unit tests for spaghetti code and on rewriting a block of code instead of refactoring it.
@-Jason-L
@-Jason-L 2 жыл бұрын
She said she purposely did not Google what it was, and treated it like a prod issue where all she had was the code and the tests. Tests are the executable specification. If the tests are wrong, that's an entirely different matter.
@alperbasak129
@alperbasak129 3 жыл бұрын
Nice oop of course, however still there is this condition in the requirements: `Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly. However, do not alter the Item class or Items property ..`
@brameldm
@brameldm 10 жыл бұрын
Looks like there's a bug that doesn't get caught by the tests after the first refactoring of normal_tick. If @days_remaining is 1 @quality should only be decremented by 1, but it gets decremented by 2. There's another bug in the first implementation of brie_tick that looks like it should have been caught by the test_brie_on_sell_date_near_max_qality but the test run that is shown doesn't show any failures. With the implementation shown, if @quality is 49 and @days_remaining is
@platonicvulpine
@platonicvulpine 9 жыл бұрын
But then you could also argue that if no test was testing for a particular behaviour, then that behaviour should not be expected of the code.
@BernhardHaeussner
@BernhardHaeussner 7 жыл бұрын
Yes, that's what I was thinking. Sure it's nice to be able to refactor some messy code. But you can't refactor messy requirements. She should at least have added a few tests for those corner cases. If you refactor production code with the attitude "well the tests pass, I don't care for anything else", you're gonna have a bad time. Users will sometimes rely on "buggy" behavior. Often while refactoring code you'll find some bugs, but this way you'll create new bugs. If you look at the actual specs (github.com/NotMyself/GildedRose) there's a lot of corner cases that she missed or intentionally left out to get pretty code.
@communtyhivemind
@communtyhivemind 5 жыл бұрын
yes, the `backstage_tick` method has the same issue too i think - if `@quality` is 49 and `@days_remaining` is, say, 3, then `@quality` will get incremented to 52. the instructions for the kata say that quality should never increase beyond 50. still a great video tho
@HoracioBertorello
@HoracioBertorello 10 жыл бұрын
Great talk. I really liked it, and I really benefited from it.
@FourTetTrack
@FourTetTrack Жыл бұрын
Sandi Metz rocks. I'm reading POODR (2nd ed) and trying to convince everyone in my organization to read it too (~50 devs working in Cobol-oriented java)
@EddyVinck
@EddyVinck 2 жыл бұрын
Even for someone like me who doesn’t do a lot of OOP, this was a fantastic presentation and I got a lot out of it.
@dirkpostma77
@dirkpostma77 6 жыл бұрын
@12:53 she compares @days_remaining
@johnnyallen4521
@johnnyallen4521 4 жыл бұрын
I noticed this too, it is an error on her part.
@maxmarion9085
@maxmarion9085 3 жыл бұрын
I feel enlightened after this talk
@JamesAJ
@JamesAJ 7 жыл бұрын
Wow, that was an AMAZING talk!
@gosukiwi
@gosukiwi 10 жыл бұрын
Wow what a coincidence! I was just reading the first chapters of her book and was thinking "Oh wow this really resembles what I'm reading about...". A happy accident! :)
@chuntaolu3977
@chuntaolu3977 10 жыл бұрын
Amazing talk!
@felipealvarez1982
@felipealvarez1982 2 жыл бұрын
The original Gilded Rose kata prohibits changing the Items property and the Item class. I'm not convinced that Sandi avoided changing those two things... She creates a new class and called it Item, and the Items property does not appear in her final code.
@tanvski5984
@tanvski5984 2 жыл бұрын
she is the best everrr!!!
@nicolrz
@nicolrz 3 жыл бұрын
There is a problem. The point of the talk is to demonstrate how to reduce complexity with small and interchangeable objects, but she demonstrates something else. She successfully reduces the complexity for the following reason: she throws away the code, re-writes it from the tests and has fewer branches. That does not show how the small and interchangeable objects make it less complex. When she adds the factory class and the abstract class, the code becomes slightly more complex by introducing two new concepts and indirections. I'm not saying small and interchangeable objects are bad, I'm saying this talk did not really showed me why it's good. Nice presentation anyhow.
@loekiedepo
@loekiedepo 2 жыл бұрын
Depends on how you look at it. The original if-statement is a horror for anyone to understand. Like she mentioned, better-than-average programmers get stuck on the problem quite easily. In the new design, the only hard things are the relationships between the objects, and the role that each object plays. By explicitely telling that GildedRose is a factory class, most OO programmers already know what it does. (though it is hard if you're not used to OO). Then the only thing left is to find out the relationships between the objects, which is easy enough because there are very few methods, which consist of 4-5 lines at the max. Understanding the new design is not easy per se, but it is definitely easier for most programmers. The ones that are more experienced in OO have an even easier time because they know what a factory is and as such, know that the different Item subclasses are just there for the Open/Closed principle. Compare that with trying to understand the original if-statement and hopefully you can see that the "time to understanding" has been lowered from possibly hours to 2 or 3 minutes at most. She is not saying it is easy. The problem is hard and ugly, which that means the code will be hard. But she is saying it does not have to be ugly. That is what she's trying to show.
@tanrosa
@tanrosa 3 жыл бұрын
Amazing lecture!!!
@gwho
@gwho 4 жыл бұрын
good video, but damn, that 20p60 30i60 at the top left that blocks EVERY SINGLE SLIDE
@alvespedro
@alvespedro 2 жыл бұрын
Holy crap, what a lesson!
@vk2sky
@vk2sky 6 жыл бұрын
Great video, like most of Sandi's work. One nitpick though - at 23:53, shouldn't "item.tick" be "@item.tick"?
@TheUnorthodoxGears
@TheUnorthodoxGears 5 жыл бұрын
No "item.tick" is running a procedure on the object "item". "@x" is used for variable assignment
@lucasbenevides1020
@lucasbenevides1020 3 жыл бұрын
@@TheUnorthodoxGears which 'item'?
@jonaskoelker
@jonaskoelker Жыл бұрын
I believe there's a bug: take a normal item with quality=1 and a negative sell-by value. The quality is not zero, so it will be decremented. _Twice._ This makes the quality field negative, in violation of the requirements. The way to easily catch this: keep the old code around while refactoring. Have a test which runs both the old code and the new code for every interesting value-that is, with name equal to each string in the old code, with sell-by ranging from -2 to 12 or so (making sure to dodge off-by-one errors) and with quality ranging from -2 to 52 (dodging off-by-one errors around the 0-to-50 quality interval). The assertion is that the old code and new code produce the same answer.
@MohammadKamran-mo8pj
@MohammadKamran-mo8pj 5 ай бұрын
Amazing. Thank you.
@itsukiuehara6292
@itsukiuehara6292 4 жыл бұрын
sandi metz u are a goddess of ruby
@theREALhaiaix3
@theREALhaiaix3 6 жыл бұрын
how could a subclass NOT be in the leaf nodes? isn't it a given?
@KarlRamstedt
@KarlRamstedt 6 жыл бұрын
An intermediary class (one that both inherits from a superclass and has subclasses) is a subclass that could be functionally used in a program. Having such a class structure is dangerous since it has a tendency to break things in subclasses when code is changed in this intermediary class. This is why it's recommended to have an inheritance structure where the only classes that are functionally used in the program are the final - leaf - nodes. A tool you can use to enforce this behavior is to use abstract base classes that are only used to inherit from. To further enforce this you can also seal your final nodes to prevent subclassing ("sealed" keyword in C#, "final" in C++/Java/probably more).
@georgmavridis8824
@georgmavridis8824 2 жыл бұрын
Nice talk, but the first refactoring was erroneous. Obviously, a test-case with remaining days '1' was missing (as her refactored code would have reduced the quality by 2 in this case).
@bradleywoolf3351
@bradleywoolf3351 Жыл бұрын
incredible
@ottowhite9742
@ottowhite9742 3 жыл бұрын
That was so good!
@nikitphadke
@nikitphadke Ай бұрын
very beautiful
@ahallock
@ahallock 6 жыл бұрын
Love this talk and the solution is pretty solid, but I still feel like it's overly complicated and you could accomplish the same thing using simple immutable functions instead of creating all these classes. Like, what's the point of even storing state in these classes for a simple `tick` method? Just have a look up table that grabs the appropriate function. You could even put in a default function for the Item class. It would look something like `lookup_tick_module(name).tick(quality, days_remaining)`
@jjw2844
@jjw2844 3 жыл бұрын
What are immutable functions? I know immutable data, do you mean functions that return immutable data? Not sure how that would be relevant here.
@i-am-the-slime
@i-am-the-slime 2 жыл бұрын
I'm under the impression it all went to shit when she went from small methods to small objects. I fail to see how she didn't contradict her own principle of the wrong abstraction is way more expensive than some duplication. I wonder if she'd still defend this today.
@FireDragonDoL
@FireDragonDoL 7 жыл бұрын
Any chance someone has a reference to the github repository used for this gilded rose? I found various, but would like one with a working test suite
@tddtv
@tddtv 3 жыл бұрын
the point is to learn how to write tests around it, that's part of the kata. She didn't mention that she wrote those tests, they didn't just appear out of the blue.
@RizalMuthi
@RizalMuthi 9 жыл бұрын
this is super awesome...
@haimif
@haimif 6 жыл бұрын
Thank you Sandi! This was very helpful! Bill Sourour of devmastery.com sent me here :)
@CalebJenkinsOnGoogle
@CalebJenkinsOnGoogle 8 жыл бұрын
I love the points in this talk. It's also worth reading Sandi's blog post on the topic. www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction
@Demondzeta
@Demondzeta 9 жыл бұрын
does someone knows about some kata i can use to practice this?
@soymichelo75
@soymichelo75 9 жыл бұрын
+William Ocoró (Demondzeta) github.com/emilybache/GildedRose-Refactoring-Kata pick the language :)
@VjgNcwejkleOcl
@VjgNcwejkleOcl 8 ай бұрын
spitting fax fr fr
@hajlander1000
@hajlander1000 5 жыл бұрын
Good talk.
@lucasbenevides1020
@lucasbenevides1020 3 жыл бұрын
Why in 10:14 she use writes 'if name == 'normal' and not 'if @name == normal'?
@loganmoseley
@loganmoseley 7 жыл бұрын
Once again, we ignore the possibility that our tests don't test every input and output. And why should they? If they did, we'd replace the tested function's implementation _with our tests_. Do not delete code you don't understand just because x tests pass. Aside from that, thanks for the perspective, Sandi.
@di3g04
@di3g04 6 жыл бұрын
Very true. You should not test that way either
@driziiD
@driziiD 4 жыл бұрын
brilliant!
@ghosty918
@ghosty918 5 ай бұрын
A list of bugs in her refactored code: 1) items without a special case are treated as Sulfuras, not Normal. Easy fix. 2) normal items can be reduced below 0 quality if odd after expiry date. Once reduced below 0, will continue deeper into the negatives 3) aged brie can increase above 50 quality if even after expiry date. Once increased above 50, will continue higher 4) backstage pass can increase above 50 when days remaining is less than 10. This corrects after the concert occurs 5) Conjured items can be reduced below 0 if it begins with an odd number quality. Once reduced below 0, will continue deeper into the negatives 6) the goblin in the corner may get mad (he has the item class and she has basically remade her function into an item repackager). 1 is easy to fix, the no-match case should return a Normal object 2-5 is the same basic error just duplicated. It just needs a set to 0/50 end to the functions. 6 is a diplomacy check against your fellow programmer.
@KrystalMoonbeam
@KrystalMoonbeam 6 жыл бұрын
A 5000 line Active Record object? I think once you get past a couple hundred with AR, you're lost. Put the keyboard down and rethink what you're doing.
@itsukiuehara6292
@itsukiuehara6292 4 жыл бұрын
is GildedRose a real class written by some programmer ? wtf ?
@allaboutruby7343
@allaboutruby7343 4 жыл бұрын
Sandi is GOD!
@arunsasidharannambiar
@arunsasidharannambiar 6 жыл бұрын
Kent Beck's statement: twitter.com/KentBeck/status/250733358307500032
@skytech2501
@skytech2501 2 жыл бұрын
she lost me when she said "Inheritance is not Evil"; we have to stay away from inheritance because we can't predict the future. We always make changes, therefore it's better to write smaller interfaces where you know what the requirements are and compose multiple interfaces together to get desired output you want.
@marcusrehn6915
@marcusrehn6915 Жыл бұрын
Agreed, her implementation was honestly a lot better around 15 minutes than it was at the end of the talk.
@araslanov_e
@araslanov_e 10 жыл бұрын
Это нечто В)
@ryanrobinson8682
@ryanrobinson8682 2 жыл бұрын
I recently did this in C#, there's a few things I disagree with in Metz's approach, having separate classes for brie and concert tickets, how would that scale in a real world example? If you had thousands of types of food and cheeses, your going to add a new class for each one? Also one of the requirements is to not change or mutate the item class, but she has changed the design drastically, which violates the non functional requirements. I still believe that business logic should be in your domain services/presenters, not in the business entities. Putting business logic in your domain models directly gets out of control and ends up leading to longer term bad designs where the entities become god objects, and monolithic themselves. I prefer a clean abstraction that handles one thing (updating quality) maybe another abstraction that handles something like (updating expiration dates)
@JosephDalrymple
@JosephDalrymple Жыл бұрын
All fair points. I think one of the difficulties, though, is when you're brought in for tactical coding (like in her case). Ultimately, there's a deeper issue related to the entire architecture of this project, but that can't always be solved in the outset. It can be tempting to throw the baby out with the bathwater, but it's not always practical or possible to do so. After all, we live in the real world. Contracts have limits and budgets, and many times there are for more issues than you can address in one go. Often times, at the end of a tactical coding contract, you're not only providing the code as a result of your refactorings, but giving the client a clear path and plan forward on how to remedy the issues from a long-term perspective; educating the client is imperative. Not all clients will heed this, and you'll very often get a call back a while later to fix something that has gotten out of control again. But, ultimately, it's important to educate in addition to fixing the issue in the short-term.
@ericterry281
@ericterry281 3 жыл бұрын
Poor camera person. Hard to track the speaker when they are walking around so much.
@slbdnkrmpc9951
@slbdnkrmpc9951 5 жыл бұрын
who else came from Object-Oriented Programming is Embarrassing ?
@shipper66
@shipper66 10 жыл бұрын
This talk could also be titled "OO programming" sucks.
@shipper66
@shipper66 9 жыл бұрын
No it's not. For me it is ironic how OO people are trying to make their code loosely coupled but they are missing the biggest problem which is right in front of them, it's the objects that promote strongly coupling data and operations that you can perform on that data. And there is no way you can escape this, it's the classes that enforce this style of place oriented programming. Not to mention that you lose the notion of time while doing OO.. enough said. I just think OO is a historical mistake.
@Icaruj
@Icaruj 7 жыл бұрын
Here is a sample of the "functional is the silver bullet" bandwagon that started in the 2010's.
@CatchTheBus
@CatchTheBus 6 жыл бұрын
Juraci Vieira lmao
@wulymammoth
@wulymammoth 5 жыл бұрын
Valentín because it is inherent -- objects encapsulate state AND behavior. Functional programming languages do not couple the two. You have data and then you have functions (behavior) that transform that data
@lagiator
@lagiator 5 жыл бұрын
amazing talk!
RailsConf 2015 - Nothing is Something
35:53
Confreaks
Рет қаралды 77 М.
Rails Conf 2013 The Magic Tricks of Testing by Sandi Metz
32:23
Confreaks
Рет қаралды 127 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 86 МЛН
hafentalks #7 - Sandi Metz: "Go Ahead, Make a Mess"
40:01
InVision AG
Рет қаралды 13 М.
GORUCO 2009 - SOLID Object-Oriented Design by Sandi Metz
47:12
RailsConf 2016 - Get a Whiff of This by Sandi Metz
38:15
Confreaks
Рет қаралды 49 М.
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
Baruco 2013: Rules, by Sandi Metz
35:28
Barcelona Ruby Conference
Рет қаралды 30 М.
Clean Code - Uncle Bob / Lesson 2
1:06:01
UnityCoin
Рет қаралды 514 М.
Full Stack Fest 2015: Nothing is Something, by Sandi Metz
41:34
Sandi Metz - Talk Session: Polly Want a Message
41:22
Explore DDD
Рет қаралды 19 М.
Hammock Driven Development - Rich Hickey
39:49
ClojureTV
Рет қаралды 294 М.