Click here to Skip to main content
15,887,585 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionObject Composition Pin
Leslie Sanford24-Jun-08 17:27
Leslie Sanford24-Jun-08 17:27 
AnswerRe: Object Composition Pin
led mike25-Jun-08 4:30
led mike25-Jun-08 4:30 
GeneralNatural vs Surrogate Keys [modified*2] Pin
Brady Kelly20-Jun-08 10:15
Brady Kelly20-Jun-08 10:15 
GeneralRe: Natural vs Surrogate Keys Pin
mr_lasseter25-Jun-08 13:37
mr_lasseter25-Jun-08 13:37 
GeneralRe: Natural vs Surrogate Keys [modified*2] Pin
Jeremy Tierman5-Jul-08 12:53
Jeremy Tierman5-Jul-08 12:53 
QuestionServer side patterns in C++ Pin
variantseeker19-Jun-08 8:20
variantseeker19-Jun-08 8:20 
AnswerRe: Server side patterns in C++ Pin
led mike26-Jun-08 5:23
led mike26-Jun-08 5:23 
QuestionObserver - Redundant Updates Pin
Leslie Sanford18-Jun-08 23:06
Leslie Sanford18-Jun-08 23:06 
I posted a message to comp.object about this subject, but decided to post a modified version of the question here.

What I'm trying to grapple with is the cyclic nature of architectures like MVC that rely on the Observer pattern.

Say that you have a subject (or model in MVC terms) that has a set of observers attached to it. When the subject changes, it notifies its observers. Ok, good enough. But suppose that one of the observers is responsible for changing the subject. Being an observer it will receive a change notification from the subject after changing the subject. In turn, the observer may choose to update itself by querying the subject. However, this update is unnecessary as it was responsible for the change in the subject in the first place.

I was looking at MFC's Document/View architecture for inspiration. The CDocument class has an UpdateAllViews method. The method takes a CView object as a parameter. This object represents the view responsible for changing the document. The CDocument skips over it when updating its views so the specified view doesn't update itself unnecessarily. This approach requires that the View be the one responsible for triggering an update (maybe not in all cases, I'm not all that familiar with the Document/View architecture).

At any rate, this provides one way to break the cycle created by the Observer pattern when an observer can be responsible for changing its subject.

Thoughts?
AnswerRe: Observer - Redundant Updates Pin
led mike20-Jun-08 5:27
led mike20-Jun-08 5:27 
GeneralRe: Observer - Redundant Updates Pin
Leslie Sanford20-Jun-08 6:07
Leslie Sanford20-Jun-08 6:07 
GeneralRe: Observer - Redundant Updates Pin
led mike20-Jun-08 6:40
led mike20-Jun-08 6:40 
AnswerRe: Observer - Redundant Updates Pin
mr_lasseter25-Jun-08 13:36
mr_lasseter25-Jun-08 13:36 
AnswerRe: Observer - Redundant Updates Pin
Adam Jasper25-Jun-08 22:57
Adam Jasper25-Jun-08 22:57 
AnswerRe: Observer - Redundant Updates Pin
Pete O'Hanlon25-Jun-08 23:30
mvePete O'Hanlon25-Jun-08 23:30 
GeneralRe: Observer - Redundant Updates Pin
Leslie Sanford26-Jun-08 8:18
Leslie Sanford26-Jun-08 8:18 
GeneralPattern for Shared Dropdown Tables Pin
Brady Kelly12-Jun-08 3:33
Brady Kelly12-Jun-08 3:33 
GeneralRe: Pattern for Shared Dropdown Tables Pin
led mike12-Jun-08 4:47
led mike12-Jun-08 4:47 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Brady Kelly12-Jun-08 5:30
Brady Kelly12-Jun-08 5:30 
GeneralRe: Pattern for Shared Dropdown Tables Pin
led mike12-Jun-08 5:40
led mike12-Jun-08 5:40 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Brady Kelly12-Jun-08 5:53
Brady Kelly12-Jun-08 5:53 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Pete O'Hanlon12-Jun-08 9:23
mvePete O'Hanlon12-Jun-08 9:23 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Brady Kelly13-Jun-08 1:59
Brady Kelly13-Jun-08 1:59 
GeneralRe: Pattern for Shared Dropdown Tables Pin
led mike13-Jun-08 5:09
led mike13-Jun-08 5:09 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Brady Kelly13-Jun-08 8:08
Brady Kelly13-Jun-08 8:08 
GeneralRe: Pattern for Shared Dropdown Tables Pin
Joe DiNatale12-Jun-08 6:17
Joe DiNatale12-Jun-08 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.