The Artima Developer Community
Sponsored Link

Legacy Design Forum
Designing with Interfaces

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Design question

Posted by Collin Ng on October 12, 2000 at 2:33 AM

Hi, I have a design question, hope someone could give me some insight on how this is typically solved.

I have a requirement to store transactions records, each with some history. But there are different types of records, e.g. add user, delete user, add department, add company etc, and they all have different attributes and different field. At the same time, there are different types of history, e.g. "Added", "Deleted", "pending", "approved", "rejected". Each of them, again, has different attributes.

My question is, is there a design pattern that allow me to just add a transaction to say a TransactionMgr, such that when new transactions or history types are added, the main part of the system need not be modified, but I just add new transaction that implements a common interface?

1 scenario I have thought of is to have a virtual method "store" and make use of polymorphism to take care of this. The only problem though, is that the transaction entity includes control logic to store to specific table. Is that undesirable?

I'm a beginner in OO Design. Hope I'm not asking a silly question. Thanks!



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us