Models Deux

Bruce's Avatar

Bruce

11 Sep, 2012 01:14 PM

Thinking about models and views ... I think the route I am planing on taking is

  • A model may contain data that is used by multiple views
  • A model may contain data that is fetched from multiple services
  • A model will throw a ModelEvent.MODEL_UPDATED when data changes.

A change I am contemplating is that the model may throw more "specific" events based on what model data changed so that 10 mediators listening to ModelEvent don't trigger when only 1 of those mediators really cares about the data that changed. That is, when service A loads the model, it throws a ModelEvent.Data_A_Updated. When service B loads the model, it will throw ModelEvent.Data_B_Updated.

The alternative I suppose is to have many more, but much narrower models.

  1. 1 Posted by neil on 11 Sep, 2012 05:03 PM

    neil's Avatar

    I would personally see the fact that you have ServiceA and ServiceB as an indication that you are modeling two things, and would have ModelA and ModelB.

  2. 2 Posted by Bruce on 14 Sep, 2012 12:29 PM

    Bruce's Avatar

    So, if you know what the Twitter API looks like, are you saying that you would have a model for each and every endpoint that Twitter provides?

  3. Ondina D.F. closed this discussion on 15 Oct, 2012 08:38 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac