RailsConf 2015 - Nothing is Something

Sdílet
Vložit
  • čas přidán 29. 04. 2015
  • By, Sandi Metz
    Our code is full of hidden assumptions, things that seem like nothing, secrets that we did not name and thus cannot see. These secrets represent missing concepts and this talk shows you how to expose those concepts with code that is easy to understand, change and extend. Being explicit about hidden ideas makes your code simpler, your apps clearer and your life better. Even very small ideas matter. Everything, even nothing, is something.
    Help us caption & translate this video!
    amara.org/v/G6rJ/
  • Věda a technologie

Komentáře • 60

  • @CaioCSG1
    @CaioCSG1 Před 4 lety +27

    It's strange how I keep coming back to this video whenever I'm using too many if statements

  • @uliwitness
    @uliwitness Před 3 lety +12

    This talk is not just amazingly interesting, but Sandi Metz does an AWESOME job at presenting this content in such a clean, efficient and funny way.

  • @christhecode8153
    @christhecode8153 Před 8 lety +84

    I'm gonna give you a timestamp, but only if you promise me dearly that you *do **_not_** skip ahead*. Promise me. You will want the build up. You don't want to spoil it. This talk is simply too good to ruin! Watch it from the beginning and listen carefully. Do *not* skip ahead. The talk is one fantastic buildup with the first massive bomb dropping at 27:24. When I first watched it, it forever changed the way I think about classes.

    • @wulymammoth
      @wulymammoth Před 5 lety +4

      Just discovered this gem of a video now SMH. But I really thought about functional programming here when this was presented -- a clear separation of data and behavior. I've been doing Elixir for the last two years but am back at a Ruby shop and this also changes the way I now write software. Composition with dependency injection makes so much sense for me now in OO languages

  • @arthurcarchi4045
    @arthurcarchi4045 Před 4 měsíci +1

    Much love to Sandi Metz work ! A really great talk !

  • @artificemm
    @artificemm Před 9 měsíci +1

    What a teacher! I'm so grateful for these recorded talks of Sandi.

  • @MartinKrisell
    @MartinKrisell Před rokem +1

    One of the reasons I recently studied Ruby was to fully understand this talk. Amazing Sandi!

  • @mguven
    @mguven Před 5 lety +7

    second part of the talk where she emphasized the composition + dependency injection is remembered me strategy pattern. absolutely it was a very good presentation.

  • @stephenjames2951
    @stephenjames2951 Před 3 lety +2

    It’s not often that a five year old talk in tech is still relevant and interesting.

    • @askegg
      @askegg Před 3 měsíci

      8 years now, and still relevant.

  • @leanguardia
    @leanguardia Před 6 lety

    Seek for Abstractions, sometimes hard to encounter, they seem to be nothing but they're always something!
    Thank you Sandi, you're the very best!

  • @danieklin
    @danieklin Před 3 měsíci

    This is a great talk and give me insight of object oriented programming design.

  • @pablofonseca9205
    @pablofonseca9205 Před 7 lety +9

    Sandi Metz rocks!

  • @silentraisin
    @silentraisin Před rokem

    i am in the middle of doing an assignment and i ran into the more inheritance problem and this just opened up my third eye to multi-verse. wonderful presentation incredible informative!!!!!!!!!!

  • @scytherswings
    @scytherswings Před 7 lety +2

    I was pleasantly surprised. This talk was fantastic! My perspective on OOP is forever changed ;D

  • @Sreczu
    @Sreczu Před 5 lety +1

    I'm a frontend developer, coding in Kotlin/Java (Android) and this is still the most valuable talk that I've ever heard

  • @xalizalizx
    @xalizalizx Před 8 lety +17

    Great talk! Also, great slides and humor :D

  • @nickname2805
    @nickname2805 Před 4 lety +2

    I thought this was pretty illustrative and convincing of the strategy design pattern, where the null pattern is often included as a way of describing default strategy or behaviour.
    Very nice.

  • @itsukiuehara6292
    @itsukiuehara6292 Před 4 lety +1

    you are a genius at talk sandi metz I wish I can work closer with a person who has the same passion as you.

  • @DavidAllouche
    @DavidAllouche Před 8 lety +4

    This is a really deep and insightful presentation that every programmer should watch.
    So, you can boil down most of the wisdom of experienced object-oriented programmers to one statement: Nothing is Something.
    And this one statement leads to a few design prescriptions: Nil values have behaviour and should be replaced by Null Objects. Subclassing is behaviour injection and should be replaced by delegation.
    Can you similarly compact the wisdom of experienced functional programmers? Maybe... Data is code.
    All input data causes program execution. All output data causes further program execution. Down there, an int is a code that instructs an arithmetic logic unit. This is the foundation of thousands of security exploits: any data format is interpreted as a specialized computer language.
    I do not yet know what are the functional programming design prescriptions. There are obvious ones for managing systems: acknowledge APIs are domain specific languages (SQL!). Design complex data processing systems as successive interpreters (http->sql->html->dom). But can this produce meaningful prescriptions for simple programs?

  • @oussou_lessou
    @oussou_lessou Před 2 měsíci

    Sandy Metz🥰 i'm in love!! since i read his book Practical Object-Oriented Design.
    I still think about her whenever i heard the term Ruby or smalltalk. Really 😁

  • @crinklyovenchips
    @crinklyovenchips Před 7 lety +3

    "Inheritance is for specialization, it is NOT for sharing code" Sandi Metz
    the is_a relation between a base class and the sub class fools us a bit.
    What changes between a class and the subclass we are trying to make?
    We can reveal differences by making them more alike -> Duplicate to see the similarities
    Once we know what we are changing, or the dimension in which it changes, we can NAME the concept,
    We can delegate the responsibility of that concept into a new object. Inject the object and use it.
    That way we can inject a different kind of object for each of the variations of the concept we wish to use.
    That way we don't need a whole new subclass of something, but a group of classes that are only responsible for the dimension we change on

  • @marcswikull2554
    @marcswikull2554 Před 6 lety

    Excellent talk. If you're doing OOP in any language (mine is typically PHP), this is absolutely worth watching.

  • @kguentube
    @kguentube Před 3 lety

    Wow! This talk is gold! Thanks!

  • @nomoredarts8918
    @nomoredarts8918 Před rokem +1

    This is still so true. Also can be boiled down to Maybe monad

  • @willl0014
    @willl0014 Před 2 lety

    This was a master class!

  • @MurtagBY
    @MurtagBY Před rokem

    Great presentation!

  • @wul51
    @wul51 Před 9 lety +3

    this talk blows my mind! although i don't use ruby:)

  • @nullptr5285
    @nullptr5285 Před 4 lety

    Great talk!

  • @MithiSevilla
    @MithiSevilla Před 9 lety +39

    I don't use Ruby, but wow :)

    • @egdcuyagecuysadgcuys
      @egdcuyagecuysadgcuys Před 8 lety +4

      +Mithi Sevilla These ideas are not specific to Ruby. You could apply them to Python or even Java if you wanted to.

    • @MithiSevilla
      @MithiSevilla Před 8 lety +6

      Yeah I actually read her book and wrote a review after I watched this Grey G medium.com/misc-misc/review-sandi-metz-s-poodr-ch-1-4-wip-d4daac417665

    • @OttoFazzl
      @OttoFazzl Před 4 lety

      I came here from your blog post. I don't know anything about Ruby but the ideas of composition and dependency injection can easily be used with Python.

  • @__zk34
    @__zk34 Před 9 lety

    Great Talk!

  • @slackstation
    @slackstation Před 9 lety +4

    Such a great talk! Makes me want to learn smalltalk.

  • @SzanownyPanSarin
    @SzanownyPanSarin Před 9 lety +2

    Awesome presentation!

  • @gwho
    @gwho Před 3 lety

    this is all good.
    my question is how does this work if you use static functions only?
    and how does just sending a message work if you have static typing instead of dynamic typing?

  • @wotwot6868
    @wotwot6868 Před 5 lety +1

    Orderer and Formatter looks like first class functions that have the boilerplate of declaring it as a class.
    Then injection would then simply be just composing higher-order functions.
    Also having the constant DATA is the same idea of immutable data aka Values.
    This brings up my question. Does it even make sense to instantiate DefaultOrder. In "enterprisey" Java, this would be a singleton. Seems to me, all of these are singletons and multiple values.

  • @wotwot6868
    @wotwot6868 Před 5 lety +2

    Simple is not always Easy

  • @kobac8207
    @kobac8207 Před 6 lety

    I wonder how one would implement fixnum :== without conditionals?

  • @danielhoffmann7138
    @danielhoffmann7138 Před 8 lety

    I wonder what are Sandi thoughts on the Mixin pattern that is possible in some languages, it is another way to solve the RandomHouse problem, but Mixins always felt a little "impure" to me (I still use them though).

    • @RimantasLiubertas
      @RimantasLiubertas Před 7 lety +3

      The modules she mentions are the mixins you talk about.

  • @wazels
    @wazels Před 9 lety +4

    You guys should totally checkout Ruby. Great language!

  • @nghiaminh7704
    @nghiaminh7704 Před 8 měsíci

    so OO hates type check, but FP likes it (pattern matching). TIL.

  • @abdelaziz2788
    @abdelaziz2788 Před 11 měsíci

    THATS FUCKING GENIUS

  • @naan5900
    @naan5900 Před 8 lety

    Was looking for a science video.

  • @MithiSevilla
    @MithiSevilla Před 9 lety +2

    Confreaks I got so inspired by this talk I decided read her book and then got inspired again this time to write an article about her book medium.com/@mithi/review-sandi-metz-s-poodr-ch-1-4-wip-d4daac417665

  • @neerajsewani5764
    @neerajsewani5764 Před 4 lety

    Vasiliy sent me here.

  • @magne6049
    @magne6049 Před 2 lety +2

    31:47 "Composition + DI = Object Oriented Design". That's ironic, since the solution proposed here, which replaces Inheritance (which is otherwise normally considered a core concept of OOP), is basically Functional Composition (with the overhead of being wrapped in some objects and classes). It could simply have been functions called: default_order(), random_order(), default_format(), echo_format(). Instead of wrapping in *Orderer and *Formatter objects (which are nounifications of natural verbs/actions aka. functions).

    • @user-ff9oq6jg9c
      @user-ff9oq6jg9c Před 2 lety

      i think the main point is by wrapping those functions in Orderer and Formatter objects we can use polymorphism. This can't be achieved by just calling functions without wrapping.

  • @abdelaziz2788
    @abdelaziz2788 Před 11 měsíci

    NULL OBJECT PATTERN

  • @sohangchopra6478
    @sohangchopra6478 Před 2 lety

    What is the need for all these Orderer classes? Just pass a function (or a block, as it's called in Ruby) to the data method!! IMO a class with just one static method is pointless - it should be replaced with a plain function.

    • @dardanbekteshi3177
      @dardanbekteshi3177 Před 2 lety

      They are not static methods but (polymorphic) instance methods.

    • @user-ff9oq6jg9c
      @user-ff9oq6jg9c Před 2 lety

      In the example there were only two cases(default and another), but what if there were more than that?

  • @dzigerica666
    @dzigerica666 Před 6 lety

    Well to copy whole of the code is kinda honest haha.

    • @dzigerica666
      @dzigerica666 Před 6 lety

      and she said honest 2 seconds after i posted comment...

  • @RobertPenner
    @RobertPenner Před 8 lety +1

    Nice demonstration of the Null Object Pattern. In the RandomHouse example, though, it seems the "orderer role" should just be a function. Why wrap the function in a superfluous class? Just use a lambda. Let's not pat ourselves on the back about "Object-Oriented Design" when a functional design is more appropriate.

    • @koshu4
      @koshu4 Před 7 lety +3

      Eh, I hate to break this to you but in Ruby, a lambda or proc is an object anyway where the block is invoked via its :call method. So that's using a class anyway. You can even define extra methods on the object by opening its eigenclass.
      And when you want to reuse it elsewhere, or you find your injectable behaviour has state or a lifecycle, then you'll find it necessary to have a named class.

  • @shipper66
    @shipper66 Před 7 lety +1

    Huh, If this is OO at it's best I really don't get what is the benefit of using OOP. In the Hose example, she had to invent new objects to encapsulate correct order algorithm and formatting. This can all be described in one single hash map as options {order: :random, echo: true } then just have one function Array, HashMap ----> Array