Can model use observer to get input?MVC vs. Observer PatternIs there a JavaScript MVC (micro-)framework?Naming Classes - How to avoid calling everything a “<WhatEver>Manager”?How to face observable object containing an observable fieldWhat are the differences between Abstract Factory and Factory design patterns?Can the Observer Pattern be removed from MVC?Sending data from observer to observableImplementing MVC and Observer PatternObserver pattern role in asp.net mvcIn MVC pattern, can the Model interact / modify the View?
Would the Aeroflot Flight 1492 have been able to dump its fuel first before landing?
Smallest Guaranteed hash collision cycle length
What kind of SATA connector is this?
Extracting sublists that contain similar elements
Is taking modulus on both sides of an equation valid?
Why did I need to *reboot* to change my group membership
Extracting X and Y coordinates from .gpx file using QGIS?
Using curl along jq
Can someone explain homicide-related death rates?
Conditional probability - sum of dice is even given that at least one is a five
LWC1513: @salesforce/resourceUrl modules only support default imports
Is the schwa sound consistent?
Replace all items that are not belong to characters and numbers by ' '
What are the holes in files created with fallocate?
How can a vertex have a normal?
Is it practical to use a slug-tuned variable inductor in an antenna matcher (aka "antenna tuner")?
Jumping frame contents with beamer and pgfplots
What's the difference between "за ... от" and "в ... от"?
Jesus' words on the Jews
Effects of ~10atm pressure on engine design
How can I answer high-school writing prompts without sounding weird and fake?
Is the circle homeomorphic to a 6 petal rose?
Why does the Earth follow an elliptical trajectory rather than a parabolic one?
Earliest use of "rookie"?
Can model use observer to get input?
MVC vs. Observer PatternIs there a JavaScript MVC (micro-)framework?Naming Classes - How to avoid calling everything a “<WhatEver>Manager”?How to face observable object containing an observable fieldWhat are the differences between Abstract Factory and Factory design patterns?Can the Observer Pattern be removed from MVC?Sending data from observer to observableImplementing MVC and Observer PatternObserver pattern role in asp.net mvcIn MVC pattern, can the Model interact / modify the View?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Observer by definition is just an observer/update mechanism and if user interacts with model, it leads to MVC pattern but can a model ask observer to get input?
From implementation point of view, it works well and the model waits for input from the user but would this be a bit of violation of observer pattern (which is generally one way)?
Alternatively, I will have to handle the case when the observer needs input in a view and make the method in model not ask for user input.
model-view-controller design-patterns observer-pattern
add a comment |
Observer by definition is just an observer/update mechanism and if user interacts with model, it leads to MVC pattern but can a model ask observer to get input?
From implementation point of view, it works well and the model waits for input from the user but would this be a bit of violation of observer pattern (which is generally one way)?
Alternatively, I will have to handle the case when the observer needs input in a view and make the method in model not ask for user input.
model-view-controller design-patterns observer-pattern
...but can a model ask observer to get input?the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)
– Valentin Carnu
Apr 3 at 11:50
add a comment |
Observer by definition is just an observer/update mechanism and if user interacts with model, it leads to MVC pattern but can a model ask observer to get input?
From implementation point of view, it works well and the model waits for input from the user but would this be a bit of violation of observer pattern (which is generally one way)?
Alternatively, I will have to handle the case when the observer needs input in a view and make the method in model not ask for user input.
model-view-controller design-patterns observer-pattern
Observer by definition is just an observer/update mechanism and if user interacts with model, it leads to MVC pattern but can a model ask observer to get input?
From implementation point of view, it works well and the model waits for input from the user but would this be a bit of violation of observer pattern (which is generally one way)?
Alternatively, I will have to handle the case when the observer needs input in a view and make the method in model not ask for user input.
model-view-controller design-patterns observer-pattern
model-view-controller design-patterns observer-pattern
asked Mar 23 at 13:06
zarzar
4,836757107
4,836757107
...but can a model ask observer to get input?the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)
– Valentin Carnu
Apr 3 at 11:50
add a comment |
...but can a model ask observer to get input?the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)
– Valentin Carnu
Apr 3 at 11:50
...but can a model ask observer to get input? the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)– Valentin Carnu
Apr 3 at 11:50
...but can a model ask observer to get input? the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)– Valentin Carnu
Apr 3 at 11:50
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314018%2fcan-model-use-observer-to-get-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314018%2fcan-model-use-observer-to-get-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
...but can a model ask observer to get input?the model could ask the observer for input if the observer does not delegate the call for input to the observable. A decoupled solution could be to have the observer retrieve information from the observable when it is notified about changes and store those information in a context accessible to the model (e.g. have a context using a ThreadLocal to store information, an observer writing the information in the context and the model reading the information from the context)– Valentin Carnu
Apr 3 at 11:50