How should nested components interact with model in a GUI application?

Posted by fig-gnuton on Stack Overflow See other posts from Stack Overflow or by fig-gnuton
Published on 2010-06-15T21:25:17Z Indexed on 2010/06/15 21:32 UTC
Read the original article Hit count: 129

Filed under:
|
|
|
|

Broad design/architecture question. If you have nested components in a GUI, what's the most common way for those components to interact with data?

For example, let's say a component receives a click on one of its buttons to save data. Should the save request be delegated up that component's ancestors, with the uppermost ancestor ultimately passing the request to a controller?

Or are models/datastores in a GUI application typically singletons, so that a component at any level of a hierarchy can directly get/set data?

Or is a controller injected as a dependency down the hierarchy of components, so that any given component is only one intermediary away from the datastore/model?

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about mvc