PC Review


Reply
Thread Tools Rate Thread

What is the best strategy ti return when business rule is not correct

 
 
Tony Johansson
Guest
Posts: n/a
 
      31st Jan 2011
Hello!

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

//Tony


 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      31st Jan 2011
On 31-01-2011 17:28, 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


If you need to propagate errors between layers or
over more than a single call within the same layer,
then exception is ab obvious pick.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      2nd Feb 2011
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.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      2nd Feb 2011
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

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      2nd Feb 2011
On 01-02-2011 21:56, Big Steel wrote:
> On 2/1/2011 9:50 PM, Arne Vajhøj wrote:
>> That is not how usenet works.
>>
>> You post.
>>
>> You risk people comment.

>
> No it doesn't. When people tell you to back off in real life, you are
> not crazy enough not to back off and mind your own business. I am not in
> your face about anything. So am telling you to back the hell off.


Somehow I am not surprised that you are the type that
in real life tell people to shut up when they tell you
that you are wrong.

But I am surprised that anyone voluntarily confesses
to that ...

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      3rd Feb 2011
On 01-02-2011 22:48, Big Steel wrote:
> On 2/1/2011 10:02 PM, Arne Vajhøj wrote:
>> Somehow I am not surprised that you are the type that
>> in real life tell people to shut up when they tell you
>> that you are wrong.

>
> No one has the nerve to do it, since I am 6ft 6inchs and about 305
> pounds. The only reason you show any bravado, is because you are behind
> a keyboard, monitor and mouse.


I repeat: amazing what people voluntarily admit to on
the internet.

Arne



 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      3rd Feb 2011
On 01-02-2011 22:53, Peter Duniho wrote:
> On 2/2/11 11:48 AM, Big Steel wrote:
>> On 2/1/2011 10:02 PM, Arne Vajhøj wrote:
>>
>>> Somehow I am not surprised that you are the type that
>>> in real life tell people to shut up when they tell you
>>> that you are wrong.

>>
>> No one has the nerve to do it, since I am 6ft 6inchs and about 305
>> pounds.

>
> Check your BMI much?


Probably not.

It is "Obese Class II".

Which should make his doctor pretty concerned.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      3rd Feb 2011
On 01-02-2011 22:50, Big Steel wrote:
> One other thing here, you are an a-wipe that thinks what you say is the
> gospel, and the only right way is your way, a typical lunatic.


Well - I explain why I consider this and that the best based
on good software engineering principles.

Other only have the intellectual capacity to name calling and
attempting to intimidate people via their size.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      3rd Feb 2011
On 02-02-2011 22:57, Big Steel wrote:
> You are a weak little man, a responder. I'll bypass reading your other
> posts. You are pitiful.


You decide what you want to read.

Arne

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Business Rule Validation SiJP Microsoft C# .NET 6 18th Oct 2007 01:56 AM
Business Rule Validation SiJP Microsoft VB .NET 4 16th Oct 2007 02:31 PM
Rule fails to move message to correct folder - why =?Utf-8?B?Q2hlc3RudXRYMjAwMg==?= Microsoft Outlook Discussion 1 29th Aug 2006 09:54 PM
correct syntax for MOD in the validation rule =?Utf-8?B?QW5keSBRdWludGFuYQ==?= Microsoft Access Database Table Design 6 4th May 2006 11:41 PM
Oultook 2002 - set up a rule to print some emails but the formatting isn't correct =?Utf-8?B?QmVhYw==?= Microsoft Outlook Discussion 0 22nd Apr 2004 05:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:21 AM.