user945620
user945620

Reputation:

What pattern involves multiple objects sharing common data, which keeps a reference count?

Suppose you have multiple objects that all need to be independent, but they all need to share a common data set, and each presents that data differently and may use different parts of that data. But each shared common datum represents one unique thing.

Example: Multiple thread objects (run loops) are running and each has its own understanding of a database table. Let's say 3 of them are accessing it at one time. The common database has a reference count for the table of 3, because there are 3 users thereof.

Example 2: An NSString object is held by multiple objects throughout a Mac OS/X program.

Probably this is a very common and mundane pattern, but which one?

Thanks.

Upvotes: 0

Views: 125

Answers (1)

Stuart Golodetz
Stuart Golodetz

Reputation: 20626

Sounds like model-view. The common data set is the model, and the multiple objects that present that data in different ways are the views.

Upvotes: 2

Related Questions