![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Up to now my experience with Flex/AIR has been mostly small programs, studying
Flex/AIR, and the joy of contributing to this forum. I'm now in the middle of developing my first "real" Flex/AIR app, in that it is tied to a quarterly goal, and over time others in my department will actually use it. I've broken the app into several MXML components, and there are components that use components, that use components (several levels of nested components). As you might imagine, sometimes these components need to reference variables/functions in other components, or in the main app, and I think I've done fairly well, based on my limited experience with this sort of thing (I'm not a programmer by trade, but I seem to fairly sharp ???), but I can't help think things are too tightly coupled. Should I be trying to push the limit in communicating between the app and the components and among the components using only events, often custom events, entirely if possible? I know practice makes perfect, or well, you know..., but I want to "do it right" as much as possible now. Thanks very much!!! Greg |
| Sponsored Links |
|
|||
|
An "Application Framework" is what you need.
There are many in Flex including PureMVC, Cairngorm and others. I found one seemingly unique in the Flex world, Mate: a "tag based" framework. Within Mate you can implement many design patterns, not just MVC; one of which is sure to meet your application needs and programming style. Mate Link: http://mate.asfusion.com/ |
|
|||
|
There was an email this morning asking a similar question on the Adobe internal
Flex mailing list, and they mentioned Mate as well (fate???). This is all good info, but in that email they suggested learning flex well first, including the using events effectively, modules, etc. I wonder if you all might be able to comment on one of my original questions: "Should I be trying to push the limit in communicating between the app and the components and among the components using only events, often custom events, entirely if possible?" |
|
|||
|
OK, although I am not the best at Flex, here is what I think.
"Should I be trying to push the limit in communicating between the app and the components and among the components using only events, often custom events, entirely if possible?" No, well maybe or sure. It depends... There are major segments in a Flex swf: Application, UI views, components and controls... As well as different kinds of events, say user gestures and system events. And there are many design patterns that make the application lifecycle manageable: development, testing and maintenance. Design patterns differ in approach: some tightly couple a view to it's controller/model. Even there the view may be active or passive. A tightly coupled active view would simply call methods on it's associated model/controller whereas a passive view may have data pushed into it via bindings and injectors. The controller may use events to access services from the main application controller. So it is the design structure (design pattern) that guides one along with a consistent set of guidelines for the development: events vs calls vs bindings vs injectors vs observers... Consistence is the key. And a good proven design pattern that fits your particular application needs is the key design guide: events vs method call; passive vs active view; ...etc. And finally, it is often a "framework" that provides the foundation and supplies the specialized classes to ease the implementation. This set of articles on the "Presentation Design Pattern" is a good read and I recommend you read it for a far better understanding that I can offer. That is simply the Presentation Pattern and of course there are many others like MVC. Mate is simply a framework; a lib of tag elements that better enables the application of your selected design pattern into the Flex framework. It is event and injector oriented. Well, I hope that helps. |
|
|||
|
Without a doubt - yes.
Most certainly in app's that need to last longer, it is vital to decouple as much as you can. In most apps I use PureMVC and I guess the main reason is the Mediator. This class is loosely coupled to a mxml (most likely) component by way of a reference. The Mediator registers event listeners with the framework for the events it's interested in. And when receiving an event acts by using the API of the mxml component. The mxml component only dispatches events to the Mediator and the Mediator then decides what to do. Today I needed to do a client change on a running app and the only thing I needed to do was modify a Mediator to listen for an event that was already broadcasted and add a public function to its mxml component. In every aspect I can honestly say that an event driven app is in my point of view the way to go. |
|
|||
|
Thanks for your input Greg. I'm a little weak on design patterns. Right now I'm
trying to firm up my uderstanding of MVC and possibly MVP, so I can start to introduce some of these concepts into my app. Greg |
|
|||
|
"Greg Lafrance" <webforumsuser@macromedia.com> wrote in message news:gcl8b2$ptt$1@forums.macromedia.com... > There was an email this morning asking a similar question on the Adobe > internal > Flex mailing list, and they mentioned Mate as well (fate???). > > This is all good info, but in that email they suggested learning flex well > first, including the using events effectively, modules, etc. > > I wonder if you all might be able to comment on one of my original > questions: > > "Should I be trying to push the limit in communicating between the app and > the > components and among the components using only events, often custom > events, > entirely if possible?" That's how I've done it (bear in mind, I've only been doing this for a year). I'm starting to get to the point where I want to use a framework, but this is in large part because I want to write an eLearning framework and I doubt I'll succeed without first understanding existing frameworks. HTH; Amy |
|
|||
|
@greg - I have decided to move from an MVC/MVP model to the Presentation
Model. It "feels" better to me and fits well with the kinds of applications I would like to develop. @LuigiL - The presentation model eliminates the need for the mediator. The mediator in flex is really a hold over from flash developers; flex really does not need the same development techniques. But there are enough "design patterns" to go around, LOL. So whatever fits the goals best is most likely the best to employ. |
|
|||
|
Here is a link that gets down to a really practical level for me. It shows an
albeit simple example of taking a Flex app all in one file and breaking it into components using a simple MVC pattern. Thanks again for your help on understanding this. http://clockobj.co.uk/2007/10/17/sim...or-adobe-flex/ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise