What do you think would be the most effective solution to maintain an object status through a life cycle? The goal to be able to be continue from any state any time. During the life cycle likely to have human interactions over a variety of interface.

For example, an order which needs to be approved by a few people. Or a data supply process that can requires many people to approve or edit?

In my mind some solutions:

  • When called a function serializes the object and saves it in a database.
  • All steps of the process would be saved to somewhere (database, csv, xml, etc.), so it can always be recreated based on this.
  • Possibly a mixture of the two methods?

Any good methods for the problem?

  • 1
    Can you indicate the context of your question? Now it could apply to anything from an undo function to a request-approval process. – Bart van Ingen Schenau May 28 '13 at 14:48
  • I just thinking of what directions/solutions(patterns) need to follow to create a high-performance system. The system's main task is creat/build an object what can modified through a variety of interface. It can modify both in terms of data and states. Avaliable states present in state graph. The data will be storage objects that can be delete, add, modify. The object waiting for another state steps over several days. Depending when you interact with it, or what the schedule requires. – István Simon May 28 '13 at 15:52

It sounds for me that you are mixing two problems into one here. In order to implement an object that can “continue” from any state, you probably need to implement a state machine.

As for serializing the object in case you need fault tolerance or some kind of persistence, you can use a lot of things — a database like SQL, No-SQL, Berkeley DB, or maybe a simple binary file, shared memory, or something like that. Which one to use depends on what exactly you need or what you already have.

In terms of what design patterns you may use, check these out:

  • I think state machine is need for solved the problem. But my problem is: What is the most efficient way to storage and update the object through their life cycle. – István Simon May 28 '13 at 13:11
  • 2
    @IstvánSimon: Depends on a life cycle, an object itself, and of course the requirements. Your question is way too broad and lacks way too many details. You need to be more specific. – user11408 May 28 '13 at 13:24
  • Suppose that a new state come with new data and/or new decision. The object members are other objects what only contains information. – István Simon May 28 '13 at 13:40
  • @IstvánSimon: What have you tried so far? Is it not efficient enough? – user11408 May 28 '13 at 13:45
  • Only theoretical question. I'm thinking using a holder pattern with a session pattern where session is save to db depend from state. – István Simon May 28 '13 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.