2

I have to to find solution for the following problem :

I have a lot of model objects. Some model objects depend on other model objects. When the referenced model object changes dependents must be invalidated. I need to store list of my currently invalidated objects, so I can show it to the user and give him a chance to regenerate the objects if he wants to do that. The problem is how would I go with organizing and storing which dependencies an object has, and how to give and receive information when some object changes / become invalidated.

Someone can give idea , or maybe some similar pattern exists for this problem

0

1 Answer 1

4

Sounds like you need the Observer pattern:

The observer pattern (aka. Dependents, publish/subscribe) is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.