Skip to content
0:00 / 0:00

#nullobjectpattern#oop#refactoring

RailsConf 2015 - Nothing is Something

Confreaks

42K subscribers • 73 videos on Hallway • Conference channel

YouTube
  • Recommended by 3 people: 3 on Hacker News.
  • A classic. People kept recommending it from 2016 to 2024.
  • Presented by Sandi Metz, author of Practical Object-Oriented Design in Ruby
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

84K views11 years ago3 recommendations

Software designProgramming languagesDesign patternsObject-oriented designRefactoring and legacy code

Sandi Metz explains how to replace conditional checks with null objects to make code simpler, more explicit, and easier to extend.

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/

Why it's here

3 people recommend this

What people say. Recommended as an excellent introduction to Sandi Metz's approach to refactoring, object-oriented design, and avoiding the wrong abstractions.

Moments people linked to

burenon Hacker News • Recommends

On “Write code that is easy to delete, not easy to extend”

Couldn't agree more. Sandi Metz has an excellent talk touching on this topic. Developers exaggerated willingness to keep things DRY and elaborates a bit on why: it's one of the easiest things for a not-so-experienced developer to identify and one of the easiest things to teach. Edit: One of the best quotes from that talk is (paraphrased): "The wrong abstraction is a lot more expensive than duplicated code". link to this video

crabmusketon Hacker News • Recommends

On “99 Bottles of OOP now available in Python”

I'd like to mention that despite OOP being in the title, I thought this book had a lot to teach that isn't specific to OOP architecture or OOP languages. Really, I think the star of the show is TDD and refactoring. For a short intro to Sandi's style and approach, I always recommend this 35min talk: link to this video Aside from any specifically educational content, as a talk it is fantastic - funny, smart, well put together.

newtscamanderon Hacker News • Recommends

On “Classes Considered Harmful [pdf]”

The premise is the introduction is wrong. "so before we have written a single program in our language, before we know whether shared behaviour will be important in the applications that will be written in it" read the POODR book, or watch this link to this video it explains how shared behavior works without code duplication and why people tend to mess it up.

programming-talkscurated list on GitHubMentions

Under “Ruby”

Nothing is Something 00:35:52 by **Sandi Metz** (2015)

u/crabmusketin r/typescript • Mentions

On “TS & OOP beginner code review”

It's almost impossible to critique code in a vacuum without knowing the requirements. Of course, this is a learning exercise, and those almost by definition don't have requirements. So my advice will be very abstract, but I hope it's thought-provoking. > I feel the half adder class is ugly and too verbose The half adder represents a circuit composed of other gates, but it's also responsible for _driving_ those gates, which is where most of the verbosity and duplication is coming from. It's also a cause of the "performance issue" where `execute` is called twice if the user needs to set both pins. This need to have a "driver" which copies pin values around seems to me to be due to some miss…

u/crabmusketin r/typescript • Mentions

On “Factory Functions or Classes for CRUD logic?”

What was in your BaseRepo? A composition approach, without knowing anything about your specific code, might be: instead of extending from BaseRepo, TodoRepo has an instance of BaseRepo which it calls methods on. This talk is a short, fun, and IMO fantastic explanation of composition versus inheritance. The especially relevant part is in the second half, but the first half is really interesting too. link to this video Don't be too concerned by all the Ruby; the principles are exactly the same!

u/crabmusketin r/softwarearchitecture • Mentions

On “How one should start learning OOP and design patterns? Any good comprehensive course/blogs?”

…enhancement can cause damage that radiates outward in overlapping concentric circles, ultimately leaving no code untouched. Another excellent feature of the book is that Metz was influenced by Smalltalk and sees OOP primarily through the lens of message passing. This was a framing I hadn't come across elsewhere. There's some of that in this talk: link to this video…

profalseidolon Hacker News • Mentions

On “Alan Kay on the Meaning of “Object-Oriented Programming” (2003)”

Here's one talk about 'message' in Ruby: RailsConf 2015 - Nothing is Something link to this video But to me, this simply looks like Functional Programming done in an OOP mess.

ValentinTrinqueon Hacker News • Mentions

On “Maybe Functions”

You do have another solution that can lower the amount of conditions: Null Objects. These don’t fit every use cases, but they can allow you to express what’s missing, or not defined, or empty, and avoid nil pointers dereference or conditions to check the state. As Sandy Metz is used to say « Nothing is Something »0 0: link to this video

u/gingenhagenin r/compsci • Mentions

On “What are the benefits of Object Orientation”

if you like talks, this 30 minute presentation by Sandi Metz is probably the best I've found link to this video Her book POODR (principles of object oriented design) is also amazing. tl;dr How would you write code if there is no such thing as an `if` statement?

u/fedekunin r/ProgrammingLanguages • Mentions

On “Programming only with classes”

Here it is :)
2View on Reddit

u/crabmusketin r/typescript • Mentions

On “Update: How do I stop duplication of interface code?”

> I guess this starts a whole other discussion of composition over inheritance? Is it just a personal preference? Have a watch of this talk to see some discussion of the differences. The very boiled-down and pithy summary I remember from reading one of Sandi's books is: inheritance can good when subclasses are _more similar than they are different_. Composition is great for isolating pieces of behaviour that can be swapped out. People tend to reach for inheritance because it's obvious and taught a lot. But there are often times when we don't stop to think about whether two things really are more similar than they are different.

u/crabmusketin r/typescript • Mentions

On “type .kind checks vs. class instanceof checks”

You should definitely be using plain data structures and a `.kind` discriminant in cases like this where you know all the potential variants ahead of time. `instanceof` is usually an anti-pattern which signals inappropriate use of OOP. If you want to write code that deals with objects of an unknown-to-you-right-now type, you should be using classes/objects with methods, and calling those methods. You can use interfaces to ensure at compile time that there are no type errors. See below for an example. The first half of this excellent talk describes this paradigm. Sandi says: "I just want to send a message to an object". Objects should supply their own behaviour, rather than you asking what…

u/crabmusketin r/typescript • Mentions

On “How to learn OOP?”

I also highly recommend this talk if video is your thing. It's concise, entertaining, and contains a lot of highly-distilled wisdom. It's by the author of POODR and contains some of the most important insights, I think. And a useful inoculation against Java-style inheritance-oriented programming!