Design pattern for multiple view states?
I have an application that takes the user through a set of steps, conf开发者_JAVA百科iguring a product, say about 10+ screens. With options to go back, skip to a certain point etc. I need to fade between these steps, and also have language switches available at any point.
I was thinking of using an MVC style pattern, having a master view that accepts a ‘next view’ and fades it in, removing the old.
It feels bloated to have 10+ separate view classes, using similar components for this task, so was wondering what other approaches there are that I should look into? or one that is suited for this kind of application
Before separating your views, think first of what they have in common.
My first instinct would be to create a View class and set the necessary properties for the view itself, namely fading between screens and whatever else you need that has to do with design.
You say the user would configure a product , so you may want to create a Configuration class , solely for that purpose. Be careful not to introduce too much dependency between your objects.
The Configuration class shouldn't know too much about the View class, more specifically about the way it is displayed.
It's difficult to tell more without knowing your project , but the idea would be to separate view & data , look at what your objects have in common , then use variables or other objects to introduce more specificity.
I have used The Gaia Flash Framework for doing this. http://www.gaiaflashframework.com/
This video introduction http://tv.adobe.com/watch/fitc/gaia-framework-for-adobe-flash/ should get you an idea why I think it will work for you.
精彩评论