Title: Message
Hi Adam,
 
I would add this to the core business model. For me, aspects are cross cutting concerns that decrease cohesion (a product shouldn't know about logging, security or workflow, so those are the classic examples of AOP). To me it is perfectly appropriate that a business object would know about these limitations - even if you sell outside the US and this is a US only limitation, I'd still put this into the model as a "US only rule".
 
As to where it should go, it would depend on the business rule. The store might know the total you can sell to all customers, a user might know they'd bought too much within a day or a cart might know that it had too much in that given cart. (BTW, good luck with the actual logic - how do you uniquely define a customer when one person could have different email addresses, shipping addresses and credit cards?!) If you needed more than one of these rules implemented, you may make a call to a seperate object that would encapsulate all of the PSE rules. I'm guessing you're also going to have to extend the product business object to include a getPSE() method (the product knows how much PSE it contains, but not how much the store, user or cart contains, so a getter for that one piece of information is appropriate).
 
Of course, you also need to make sure that your cart.add() method returns the status of the add (you could also use this for people buying too much stuff for their credit line or ordering more product than you have in inventory or some other cases where cart.add() will fail) and probably an error message so you can display the cart view with "Cart not updated successfully: #ErrorMessage#"."
 
Just some thoughts.
 
Best Wishes,
Peter
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adam Haskell
Sent: Monday, July 03, 2006 5:10 PM
To: [email protected]
Subject: [CFCDev] Aspect or not?

As some may know the lovely US gov't has put new laws in place limiting the sale of Psuedoephedrine.  Right now I am in the process of reworking the original application into Model Glue framework also using Coldspring. So here is my question:

 Right now the Application merrily has transaction and transaction detail objects (among others). Each detail is added through an AJAX call to the server. My thought right now is to put the code that determines if the current detail can be added to the transaction into an aspect. The idea being that the core objects do not change and the transaction object can continue to happily append details, telling to persist ect. The aspect would "sniff" the detail and if the detail can not be saved due to legal limitation (too many grams of PSE or too many packages per day) the aspect throws an error OverLimit and the application deals with it. My concern is that by through the error I will end of having to deal with that in the transaction object thus changing it anyway. Maybe that's an OK thing but I need someone else to tell me that, or maybe some different suggestions. I just need a reality check from people that have probably been doing this more than me.

Adam Haskell

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to