Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modelling An Object's History

We are designing a system and one of our requirements is to be able to record various events which are enacted on our domain entities as they pass through their lifecycle. A bit of me thinks we should store all these events as "Command" pattern objects with associated metadata (actor, date/time etc.) but this is based on my having used it to implement Undo/Redo in the past which is not a requirement here. We also have the added complexity that some actions act across multiple entity types and others are more discreet.

Does anyone have any experience of this? Is the use of Command appropriate or is there a simpler way to do this?

TIA

like image 918
Andrew Harmel-Law Avatar asked Sep 06 '25 18:09

Andrew Harmel-Law


1 Answers

Instead of storing the events enacted, an alternative may be to archive the past object states.

like image 143
ChrisW Avatar answered Sep 10 '25 16:09

ChrisW