Wednesday, February 23, 2005

OO Design

I have this requirement - whenever user add an transaction, it will trigger an Email Notification. The problem is where to put this Email Notification
- in add transaction class (separate library from web application)- when the transaction is added successfully?
- in the web application controller ?
- in the code-behind of that web page?

If I put in Add Transaction class, it means whenever this feature is called, the Email is definitely triggered. What happens if another module uses this feature but does not need to trigger Email? I was thinking of using delegate and pass in the notification function.

However, triggering of Email uses SMTP, which logically should resides in web application page.

In the end, I build in the email notification (but without actual trigger of email) in add transaction class, and in the web application to trigger the actual email.

So if another function uses the same feature, it has to manually trigger the email, but at least the email contents are already set in the Add Transaction class.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home