Author Topic: History data in a class  (Read 370 times)

thomaskilian

  • Guest
History data in a class
« on: June 30, 2006, 05:17:44 am »
Hi all,
I have the follwing problem: for history reasons it is sometimes desirable to actually copy data from one class to another instead of just having a reference. E.g. I copy customer data to the basket. So these data are kept along with a purchase date. My question: is there a (common) way to depict such a copy-relation with UML? Maybe something like the nesting relation, or a stereotyped association?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5905
  • Karma: +71/-80
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: History data in a class
« Reply #1 on: June 30, 2006, 07:47:03 am »
If I understand you correctly, Thomas, you want to place a cloned copy of a customer object at a point in time within the container.

I'd opt for a new descendant class from Customer called ClonedCustomer - with the additional property of CloneDate, then since EA doesn't have containment metadata on an Association and a named navigable Association is an attribute, add an attribute to the container whose datatype is ClonedCustomer and whose containment is ByValue.

Can't guarantee that it will generate code properly, but I think that it's conceptually correct.

HTH,
Paolo
« Last Edit: June 30, 2006, 07:47:28 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: History data in a class
« Reply #2 on: June 30, 2006, 01:20:41 pm »
Perhaps you can achieve the same result with a memento pattern. The possible advantage would be that it would be lighter weight if you did not have to preserve all the class information, but only a (sub)set of the values present in the class.
No, you can't have it!

thomaskilian

  • Guest
Re: History data in a class
« Reply #3 on: July 03, 2006, 12:06:36 pm »
Hi Paolo and David,
I probably won't choose a Clone since you will not copy the complete object but only certain aspects which you choose to be relevant for history. Maybe the memento can do what I need. At a first glance it looks a bit too far off, but it's definitely worth a look. Thanks.