Timeline for OOP: Behavior + Data, but what about 'validation' behaviors?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2017 at 7:31 | history | edited | CommunityBot |
replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
|
|
Oct 9, 2014 at 22:54 | comment | added | user1293742 | If it were me I would not allow setting the start time and end time individually. I would create a ChangeTime(starttime, endtime) function and expose the actual datetime fields as read only. Other than that, Id follow Amons advice. As it is now, it sounds like you're doing it wrong. | |
Oct 8, 2014 at 19:55 | comment | added | BVernon | @JeffO I think my issue has more to do with where to draw the line between what you call an invalid object and a perfectly valid object with an invalid property. I don't think an invalid property 'necessarily' means the object itself is invalid. The simplest way I can explain this is that an employee might file a paper that's incorrectly filled out. He can pull that file out at any time to correct it. But in software I wouldn't be able to pull the file back out if my domain logic prohibited invalid property values... and I can't always force everyone to use my domain objects to save to the db. | |
Oct 7, 2014 at 18:00 | comment | added | Bill K | If you go beyond trivial validations (like null checking or basic range checking) you are probably right, they aren't behaviors and don't belong in the class. Often validations can be attached to a class through external metadata (annotations and/or data files) and can therefore be more easily manipulated, adjusted and applied at different levels (UI and database, for instance). Only validations required to ensure that the class is a valid object should be coded directly into the class. | |
Oct 7, 2014 at 16:05 | history | edited | BVernon | CC BY-SA 3.0 |
added 312 characters in body
|
Oct 7, 2014 at 16:03 | history | tweeted | twitter.com/#!/StackProgrammer/status/519518497026478080 | ||
Oct 7, 2014 at 14:56 | answer | added | Cerad | timeline score: 4 | |
Oct 7, 2014 at 13:44 | comment | added | JeffO | This Question may help: programmers.stackexchange.com/questions/119778/… | |
Oct 7, 2014 at 7:41 | answer | added | zafarkhaja | timeline score: 2 | |
Oct 7, 2014 at 7:29 | answer | added | amon | timeline score: 16 | |
Oct 7, 2014 at 5:16 | history | asked | BVernon | CC BY-SA 3.0 |