Hello Dear Robotlegs users,
I have a pretty dumb question but here goes as I Been doing both a) and b) without more than an "arbitrary" feel in my head :
Does it make sense to
a) When the service class has loaded the XML, dispatch its own
event notifying a ViewMediator that the XML has loaded or
b) When the service class has loaded the XML, dispatch an event
that the model listens to and model dispatches its own event
notifying a ViewMediator that the XML has loaded
or
c) Get out of the kitchen and go eat cookies neither a) or b) makes
sense Instead i propse c) Bla bla bla bla
Replies welcome
Thanks in Advance
Thomas
#1 Posted by Ondina D.F. Support staff on 10 Mar, 2012 11:23 AM
Hi Thomas:)
You can do that, if you don’t need a Model to work with the loaded data.
You can do that, too, but it’s not a recommended practice :) Models shouldn’t listen to events.
You could:
let the Service set the data on the Model
or, let the Service dispatch an event, that would trigger a Command, that would call a method on the Model
and let the Model dispatch an event with the updated data as a payload.
Diabetologists say, that eating cookies is not recommended while having issues with your code ;)
Ondina
#2 Posted by thomas.thorsten... on 10 Mar, 2012 11:30 AM
Thanks for the reply. I really like the last approach with Command. Why did I not think of that! It's neat, and feels more proper than setting the data on the Model.
Also, thanks for the insights about reduction of cookie eating during code issues. I shall try lemon tea, with a tad of sugar,
Thomas
#3 Posted by Ondina D.F. Support staff on 10 Mar, 2012 12:47 PM
You’re welcome.
Yeah, lemon tea, with a tad of sugar and ONE cookie should be fine:)
Ondina D.F. closed this discussion on 10 Mar, 2012 12:47 PM.