How does class-caching differ from the Singleton pattern? -TH
--- In [email protected], Romuald Quantin <soundstep.mail...@...> wrote: > > Mate is not using Singleton but "class-caching" if I understood well. > > Romu > > Tim Hoff wrote: > > > > > > > > Hi Seona, > > > > Let's start by taking a deep breath and don't freak out. Ok, wheeew! > > > > Mate is a little different than typical MVC; in that it seperates the > > model into managers and presentation models (a manager holds data and a > > presentation model holds an instance of the needed data and controls > > constituant views). Let me elaborate a little, in that these two > > factions of the model are also "smart" models; they don't just sit by > > and hold data., they can also manipulate data/state as well. Yes, both > > managers and presentation models are singletons; thus they persist. If > > you place your user data in a userManager, then you can easily inject > > that data into whatever object you want, be it a view or a presentation > > model, via a map. > > > > I know that there aren't a lot of mate examples out there yet. But, > > please be patient; more are coming...... > > > > -TH > > > > --- In [email protected] > > <mailto:flexcoders%40yahoogroups.com>, Seona Bellamy seona@ wrote: > > > > > > Hi guys, > > > > > > I'm not sure that the subject line is all that clear, but I honestly > > can't > > > think of how best to express it. My brain's just really tied in a knot > > over > > > this one. Bear with me for a moment and I'll try and explain where I'm > > > coming from and what I'm trying to do. > > > > > > I'm pretty new to Flex as a whole, and have been trying to rework an > > > existing app into the Mate framework. The original app was built when > > both > > > myself and the other developer were just learning Flex (actually, we > > learned > > > as we went along) and it quickly spiralled out of control into this > > complete > > > nightmare of code. It's been decided that Mate is going to be our > > framework > > > of choice for future Flex development, so I decided to start trying to > > > rebuild our app in it as a learning exercise. > > > > > > I used the Cafe Townsend example ( > > > http://mate.asfusion.com/page/examples/cafe-townsend > > <http://mate.asfusion.com/page/examples/cafe-townsend>) as a basis, and > > > started off. So far so good - I managed to build a login interface, > > get the > > > login function to call a CFC that looks up the details in the DB, and > > pass > > > the user off to the main interface if they were in the DB. My problem > > now > > > comes when I try to populate the main interface with the user's data. > > This > > > would involve making more calls to other CFCs, passing them the user's > > ID, > > > and getting back the records that are associated with the current > > user. > > > > > > The Cafe Townsend example didn't really help much with this, since > > once > > > you're logged in you're logged in and it doesn't really do anything > > else > > > with that information. I hunted around a bit and decided that the > > closest I > > > could find to something that might do what I need is a Model and > > Injectors. > > > The Weather Widget example ( > > > http://mate.asfusion.com/page/examples/weather-widget > > <http://mate.asfusion.com/page/examples/weather-widget>) works with > > this, and > > > I tried working it into what I had, but I suspect I've tied myself in > > a bit > > > of a knot. Despite the fact that FlexBuilder is not flagging any > > errors, the > > > app crashes the browser every time to try to run it. So I'm obviously > > doing > > > something wrong. I just can't figure out what. > > > > > > So to summarise: how do I go about storing some data in such a way > > that it > > > will be accessible to other parts of my application? For example, the > > user > > > data that is brought back by an event in the MainEventMap needs to be > > > visible to events in the UserEventMap. > > > > > > > > > For that matter, are there any other decent examples out there besides > > the > > > ones on the Mate website? > > > > > > Cheers, > > > > > > Seona. > > > > > > > >

