Timeline for Dealing with class optional dependencies
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2015 at 4:45 | answer | added | radarbob | timeline score: 1 | |
Aug 15, 2014 at 16:01 | comment | added | Dunk | While null is workable, I generally prefer to use a more meaningfully named value/enum. For example, "Unassigned/Unknown/NotSet". Usually there's any number of reasons that something can be set to null (frequently because of some error condition) so you might not know why it is null. However, if you see the value as Unassigned/Unknown/Unset then you know you either forgot to assign it or you meant it to be that value. | |
Aug 15, 2014 at 10:35 | history | tweeted | twitter.com/#!/StackProgrammer/status/500229386965377024 | ||
Aug 15, 2014 at 7:35 | history | edited | acid | CC BY-SA 3.0 |
deleted 43 characters in body
|
Aug 15, 2014 at 7:33 | comment | added | acid | You're right, I'm gonna update the example. | |
Aug 15, 2014 at 7:25 | comment | added | Kilian Foth | The problem is real, but the example is bad. If you can have an unspecified number of related products, there is no reason why the number can't be 0, so an empty array does exactly what you want. It's when you have something that may have any color or "no color" that you have a design decision to make. | |
Aug 15, 2014 at 7:19 | history | asked | acid | CC BY-SA 3.0 |