Let's say I have an AddProductToCartTask with a method Execute(). Now, the task is being called from a Controller. In the Execute method , there is a check...
Can't you always use the same viewmodel type with an enumeration of message objects for what has happened / failed with the cart operation along with the model...
Can you return always the same objects to the view? When there is an error you will pass an error message and an empty "json object"...otherwise you will pass...
Well, yeah, I could return an object with an empty or not error message. But the problem is with the AddProductTask that get's called by the Controller. Should...
I use Udi's domain event pattern ( http://www.udidahan.com/2008/08/25/domain-events-take-2/) for this, which is functional but breaks encapsulation in my...
I suggest your "You do not have enough bonus to buy this product" should be an exception that is thrown from the AddProductTask method. For example, in the...
Well, from what I've read up to this point, using Exceptions as a messaging mechanism is frowned upon - as exceptions should really for .. exceptional stuff ,...
This situation is precisely when you should use an exception. If there is a business reason for AddProductTask to fail, such as "not enough bonus", then that...
I don't have an internet link, but in my experience using custom exceptions for flow control in a validation situation is frowned on by some. It could be a...
This condition is not exceptional. It is available for the user to do. If they don't have enough to get the product and they try AND you allow the user to take...
... Define "exceptional". If a procedure cannot be completed, then you need some way of notifying the caller about the failure. You could return a value to...
... I disagree. I probably want to react to a user data validation problem differently than a system failure (e.g. security problem, resource problem). "Hey,...
Exceptions mean that the code has gotten into a state it should not be in so I'm going to spew out everything I know so someone can address the issue. For...
... Yeah, I don't think exceptions are for "exceptional" situations anyway. I like the advice in Framework Design Guidelines, throw if the member cannot do...
don't throw the exception. it is not good practice and it's expensive to raise exceptions for what is essentially a validation concern. Notification Pattern: ...
Yeah I agree, notification is a good option for many of these cases. 2009/7/10 Greg Young <gregoryyoung1@...> ... Yeah I agree, notification is a good...
Well, I'm gonna go the event way : launch an event from the task, catch it in the controller, set the message in a global message repository thingy - that will...