Timeline for Are too many if-else statements for validation bad?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 29, 2013 at 18:40 | comment | added | Doc Brown | @iAteABug_And_iLiked_it: validation rules are business logic, and when creating a business model it mostly ok design to place object-related code expressing business logic in the object's class. However, I am with Eric Lippert here, see my edit. | |
| Aug 29, 2013 at 18:40 | history | edited | Doc Brown | CC BY-SA 3.0 | added 385 characters in body |
| Aug 29, 2013 at 17:54 | comment | added | iAteABug_And_iLiked_it | @DocBrown , I understand where you are coming from. If it is a service, e.g., one is bound to have some validation. But this particular class is neither just a service, nor is it just a plain entity ( like a simple person object e.g. which only stores name, age,dob etc), instead it is trying to do a bit of both, and that with loads of if else statements | |
| Aug 29, 2013 at 15:07 | comment | added | itsbruce | The logic should be "The borrower must satisfy these rules to get a loan" and should also cover "what we say to a borrower who doesn't satisfy the rules" etc. That doesn't mean all the validation has to be in the object. Are you confusing the (OO-context) validation of a created object with the (Business context) validation of a set of business rules? It does feel to me as if you are conflating the life-cycle of a software object with the business process that it is modelling. These are checks to see if a borrower will get a loan, not to determine whether the object is created. | |
| Aug 29, 2013 at 14:33 | history | edited | Doc Brown | CC BY-SA 3.0 | added 1 characters in body |
| Aug 29, 2013 at 14:20 | history | edited | Doc Brown | CC BY-SA 3.0 | edited body |
| Aug 29, 2013 at 14:15 | history | answered | Doc Brown | CC BY-SA 3.0 |