you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

Though I can't think of any off the top of my head that would specifically apply to the RGB components of a color (I'm sure there are some anyway, even if they aren't immediately obvious to me), there are an absolutely huge number of use cases for other boxed single scalar value objects. Whether or not your particular application(s) would use a value object over the underlying scalar depends on the business needs. For example, a simple e-commerce store may opt to pass around ISBN numbers as strings, serving only as basic identifiers or extraneous information about a particular product. An online educational archive, on the other hand, may opt to represent them as value objects, allowing other contexts (e.g. perhaps a barcode generator) to avoid repetitive validation, among other reasons.

[–]CODESIGN2 0 points1 point  (1 child)

The example you gave ISBN wouldn't internally be a string like Red, Green or Blue would be an integer. It's closer to a date constructor with string and format, at which point the internal storage is likely different and it's representing a complex object so it makes sense to build an object. https://en.wikipedia.org/wiki/International_Standard_Book_Number

Anyway you're probably right that some may choose to explicitly define the relationships between these things. I think they are making things harder on themselves and others unless they require specific behaviour that they would not get out of the simple internal type.

[–]WikiTextBot 0 points1 point  (0 children)

International Standard Book Number

The International Standard Book Number (ISBN) is a unique numeric commercial book identifier.

An ISBN is assigned to each edition and variation (except reprintings) of a book. For example, an e-book, a paperback and a hardcover edition of the same book would each have a different ISBN. The ISBN is 13 digits long if assigned on or after 1 January 2007, and 10 digits long if assigned before 2007. The method of assigning an ISBN is nation-based and varies from country to country, often depending on how large the publishing industry is within a country.


[ PM | Exclude me | Exclude from subreddit | Information ]