← Back to Upcase

Value Objects

(Upcase ) #1
In this episode, Ben and Joe discuss value objects. You can learn more about value objects in Ruby Science, or on Martin Fowler's blog. You might also want to try you hand at our Extract Value Object exercise.
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/value-objects

(Dan Scotton) #2

hey guys, love the videos but unfortunately I don’t think this one did a great job of explaining value objects. The colour (I’m british ;)) example was pretty confusing, especially without seeing any code examples. The really good bit of value objects (how two instances are equal) doesn’t get talked about until ~7mins or something. This could have been explained with some decent examples such as:

Color.new_from_rgb(255, 0, 0) == Color.new_from_hex('#ff0000') # explicit static methods to show instances are created

Describing how integers could be value objects was quite confusing too (you’re right, they could be) but there are plenty of better things that could have been used as an example to describe a value object: email address, currency, temperature, weight, etc.

keep up the good work! I look forward to fridays to see the latest video from you both :+1:

(Joshua Plicque) #3

An applied example would’ve been nice. I’m left kinda clueless as to how I’m going to implement what was said here!

(Wu Qing) #4

After watching this episode, still have no clue about how to implement value object. I’d could use some code examples as well. I found some examples on this link: http://www.sitepoint.com/value-objects-explained-with-ruby/. Maybe helpful to other people too.

(Nick Schwad) #5

@wiserfirst thanks for sharing this link that’s what I was looking for. I would also recommend the Value Objects chapter in The Rails 5 Way.

(Alex) #6

This video needs some kind of code examples to be of any practical help!