On 01-02-2011 21:44, Big Steel wrote:
> On 2/1/2011 9:03 PM, Arne Vajhøj wrote:
>> On 01-02-2011 14:21, Big Steel wrote:
>>> On 1/31/2011 5:28 PM, Tony Johansson wrote:
>>>> I have a GUI class and then another class is called(animalManager)
>>>> where
>>>> some business rules are checked for example
>>>> that some food is not valid for some animals.
>>>> What is the best way to return to the GUI. ?
>>>> I think it's important for the GUI to know what kind of business rule
>>>> that
>>>> failed.
>>>> Is it a good approach to throw exception telling some info
>>>
>>> Throwing exceptions are expensive.
>>
>> Expensive is relative.
>>
>> When it is user input, then the performance impact
>> is negligible compared to the cost of bringing that
>> user input in.
>>
>>> The business object should have an exception list/collection for
>>> collecting error messages within the object that is cleared each time
>>> the object is validate. Any and all broken rules validation messages
>>> about the object should be loaded into the business object's error
>>> collection.
>>>
>>> If the errors.count > 0, then there was a validation error where you
>>> would proceed to bind the collection to a control to be displayed to the
>>> user. Otherwise, if the errors.count in the object is 0, then the object
>>> passed the validation rules.
>>>
>>> What would be returned to the UI is the object and the collection of
>>> errors within the object.
>>
>> That technique is frequently used in the UI. Several big
>> web frameworks use it.
>>
>> It is not a very good fit for passing from business layer to
>> UI.
>
> I disagree, since I have sent DTO(s) from the MVP over the WCF Web
> service and injected the object graph into a Workflow to validate the
> object and object graphs within the object. If it was not valid, send
> the DTO back to the UI. No one said anything about passing anything to
> the business layer, other than you.
Well - I did not. I talked about passing from business layer not
to business layer.
> As a matter of fact, the objects can
> validate themselves up at the UI before they are ever sent to the BLL.
That is what should be done.
But a couple of lines about you talk about validating them
after sending them via WCF to your workflow.
> Also, I am somewhat getting tired of you trying to give your spin on
> things. You need to keep it to yourself, as I could care less as to what
> you are talking about or think.
That is not how usenet works.
You post.
You risk people comment.
Arne
|