Hi Adolfo, ModelLocator is an example of the Singleton pattern http://en.wikipedia.org/wiki/Singleton_pattern
Singleton is a pattern used in programming to ensure there is only one copy of an object, which is definitely what you want when dealing with your model. Note that its just your model as a whole, it doesn't prevent you from having collections and multiples of items inside your model. As for the why, if you had more than one model it would be possible for you to set a value in one place like model.firstName = "Bob" and then retrieve it from another place and have it come back undefined because you're getting a different model.firstName. HTH, Ben --- In [email protected], Adolfo Ruiz <[EMAIL PROTECTED]> wrote: > > Sorry if my question is a little newbie but im new in Cairngorm, but does anyone knows why in every model Locator its not allowed to have more than one instance, i mean: > > > public function ShopModelLocator() > { > if ( modelLocator != null ) > { > throw new Error( "Only one ShopModelLocator instance should be instantiated" ); > } > shoppingCart = new ShoppingCart(); > productComparator = new Comparator(); > currencyFormatter = getInitialisedFormatter(); > assets = new CairngormStoreAssets(); > } > > why Only one ShopModelLocator instance should be instantiated ? > Does this is necesary for design in all models locators, ? and if so what is the first and principal reason to implement this design. > > > ____________________________________________________________________________________ > ¡Capacidad ilimitada de almacenamiento en tu correo! > No te preocupes más por el espacio de tu cuenta con Correo Yahoo!: > http://correo.yahoo.com.mx/ >

