Skip to content Skip to sidebar Skip to footer

Should I Specify The Proxy In The Model Or The Store?

I'm relatively new to cross-platform mobile development, and recently have been going through some basic tutorials on how to use Sencha Touch in my app. I have been confused by wha

Solution 1:

They leave it up to you because it's an implementation decision. The convenience of having it tied to the model dictates a strong one-to-one relationship.

In ExtJS 3.3.1 and below, the proxy was always tied to the store. It wasn't until Sencha Touch and ExtJS 4 that they allowed you to tie directly to the model.

The best reason I can think of to tie it to the model is to keep it self-contained.

Defining Proxies directly on a Model is a new approach in version 4—its main benefit is that we can easily load and save Model data without creating a Store, as we did in ExtJS 3.

Edit

Sorry if I was a little high level with my explanation.

Think of a Store as a Collection of Models.

The store can be self-aware on how to populate these models by using the proxy defined to the store. Or the Model may already know how to populate itself by defining the proxy to it instead.

Please let me know if I didn't clarify well enough. :)


Post a Comment for "Should I Specify The Proxy In The Model Or The Store?"