Re: [Flashcoders] Questions Using MVC Pattern with Flash
Hi Mike, Can you elaborate on how the Command pattern can be used instead of MVC? thanks, Jim Kremens On 11/9/05, Mike Britton [EMAIL PROTECTED] wrote: You'll quickly get into framework-building, something that can delay your project. Why not use an existing open source framework like ARP? http://www.osflash.org/ARP I've gone the route of employing MVC in every aspect of my architectures, then I discovered the command pattern, which ARP uses. Mike ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
The Command pattern is a true design pattern, while MVC is an architectural pattern. It's difficult to explain how one could be used in place of the other because the Command pattern can be used inside an MVC design/architecture. Similarly, MVC can be used inside a Command. I believe Brent's original question dealt with using MVC triads throughout an application design. I felt he was on the right track understanding the need to separate model from view, but could benefit from using the Command pattern to encapsulate actions. It would lessen the complexity (and thus improve the scalability) of his application. It's for this reason I suggested ARP. ARP has a good implementation of the Command pattern. Rather than redesign his own framework, Brent could benefit from using one that has a good community around it. Model-View-Controller http://en.wikipedia.org/wiki/Model_view_controller Command Pattern http://en.wikipedia.org/wiki/Command_pattern Mike ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
Design patterns are just a way of doing things... I once posted on my blog after reading the Head First Design Patterns book (which I think is a must-read for people getting into DP's) that you might know how to play some notes on a guitar (this is would liken to creating some variables), and you may know how to build some chords( classes ) but if you play certain notes and chords a certain way then you might be playing the blues (a design pattern). MVC is a design pattern made of other design patterns. if you get to know those first, you'll understand mvc better. there's a fine line to walk between knowing that you CAN use design patterns in your design, and that you MUST (usually people think this because someone else is doing it). Don't worry about forcing them into your work yet...but look for spots where they might be appropriate and try to work them in (by this i mean, dont worry about starting off saying, i am going to build this using the pattern). Defintely look into ARP...it's a framework that uses a bunch of design patterns to show you a good way to develop a flash app. ( Don't be worried by the word framework either -- you might even think of it as a reusable application template). On 11/9/05, Brent Gore [EMAIL PROTECTED] wrote: I think I get the idea, relax about MVC... but not too much ;). Starting out with MVC is kind of like having ten different maps that all get to the same place by different paths. Because of my own specific application needs, certain implementations (or maps) will be much better than others and figuring out which one to use is mind-boggling. Even worse, doing it with Flash is like having an extra mountain range (or something) smack dab in the middle. Taking Mikes suggestion I'm looking into ARP more. It looks pretty good but its kind-of a learning curve. I think the framework will help filter out some of the options. Anywhoo, thanks for your guys' help! I'm sure I'll feel better about this whole thing once I start actually making some progress ;). Best, Brent Message: 21 Date: Wed, 9 Nov 2005 19:58:14 + From: Johan Lopes [EMAIL PROTECTED] Subject: Re: [Flashcoders] Questions Using MVC Pattern with Flash To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 I've tried building the view completely by the controller with AS createEmptyMovieClip and such but was wasting too much time not being able to see anything at design time. I've stayed away from that too. This approach is advantageous when you're working with designers who wants to have full access to your views during design time. I chose not to pass event objects but rather fire a generic onUpdate() event on each listener. Inside oController.onUpdate() I request the info I need from the composited oModel and pass that info along to the composited view_mc. This allowed me to have different views listening to the model and each requesting only the info they needed instead of getting all-or-nothing. When my model's data changed, it all changed but all of it's listening views didn't need all of the data. I like that idea too. It's close to Moock's MVC with Observer Pattern passing only the needed data is really cool. /Johan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
You'll quickly get into framework-building, something that can delay your project. Why not use an existing open source framework like ARP? http://www.osflash.org/ARP I've gone the route of employing MVC in every aspect of my architectures, then I discovered the command pattern, which ARP uses. Mike ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
On 11/9/05, Brent Gore [EMAIL PROTECTED] wrote: This is where I really start to pull my hair out because there are so many options. I think the above would work, but I'm not really sure if that's using MVC correctly. Hey man, that's what happens to everyone. Don't sweat it. Seriously, design patterns are sort of your road map. It's not important EXACTLY how you get there, and if it's easier for you to walk around something, then walk around something, don't force yourself to walk OVER something just because the map says that's the direction you need to go in. In other words, just start off doing what makes sense to YOU. What makes YOU comfortable. Trust me, you'll go back and revise your code a hundred times, maybe more, and the next project you work on will change because you'll take lessons from the previous one. The most important thing about design patterns and frameworks is just that you USE them. There is no real right way or wrong way. There are ALWAYS places that someone would step in and say, oh, I'd do it this way...not that way...and all you can do is just take it in, see if it's appropriate and applicable to your project or workflow and implement it or not. I guess what I'm trying to say is, just the fact that you're USING a design pattern or framework is a great start. You're already doing the most important thing right. The rest will just come to you... ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
On 11/9/05, Johan Lopes [EMAIL PROTECTED] wrote: Hey man, that's what happens to everyone. Don't sweat it. Seriously, design patterns are sort of your road map. It's not important EXACTLY how you get there, and if it's easier for you to walk around something, then walk around something, don't force yourself to walk OVER something just because the map says that's the direction you need to go in. Jeff, this is really a great analogy and I agree to a certain extent but... In other words, just start off doing what makes sense to YOU. What makes YOU comfortable. I have to disagree here. This is only OK if you are 100% sure you're the only person who'll ever work on a project. I guess it's cool to mess around with MVC implementations on your personal projects as an exercise - to get a feel for it. I've been involved in various commercial projects lately where we've used various types of home-cooked MVC frameworks and experience tells me that if you want your project to be maintainable, stay away from the do-what-you-like type of MVC implementations. Well, to be fair, and I should've been a little clear. In my analogy that would've sort of been like telling him he could just make up his own map as he went along. I think following the standards and coding practices of a framework are the most important things about them. I agree 100% with what you typed. You'll get no argument from me...lol... I should've been a little clearer. Once you've got the map, walk and traverse at a pace and level that you're most comfortable with, I think. I know some people that are absolutely fanatical that EVERYTHING be MVC to the bone, and some people that realize that some web applications tend to be less complex than people make them, and probably don't need an extensive level of adherence to MVC principles. It always seems like it's the latter that are most laid back and most at ease with their programming, in my experience. I can, and I'm sure you can too, empathize with people who are a little nervous or skittish about how best to jump into something like a framework. It takes a certain level of self confidence to sort of step in and take on structured programming and not kill yourself worrying over whether or not you're executing EVERYTHING in a perfect MVC world. I think that's the stress on people who first pick up a framework. It's not really much more than a couple of kind words and a few, don't worry, we've all been there...jump ins can't fix...lol. I certainly don't recommend reinventing the wheel and trying to take on both adopting a framework AND inventing one at the same time. I think the best part of frameworks, and if I'm not mistaken, the purpose of them, is to promote code reuse, and I certainly wouldn't try to invent something that the kind folks who have worked on the MVC framework have worked tirelessly on. My two Scheckles. True, there's no right or wrong way when applying MVC. But I'll have to agree with Mike about using something like ARP or Cairngorm. Both of these are well-documented with full UML diagrams. This way, if you get stuck you have a community to go to for help. Sorry, I didn't mean to start an MVC war or anything like that - I'll leave that to the SmallTalk and Java gurus who have been at it since early nineties ;-) Just my 2 pence. Cheers, /Johan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
I've tried building the view completely by the controller with AS createEmptyMovieClip and such but was wasting too much time not being able to see anything at design time. I've stayed away from that too. This approach is advantageous when you're working with designers who wants to have full access to your views during design time. I chose not to pass event objects but rather fire a generic onUpdate() event on each listener. Inside oController.onUpdate() I request the info I need from the composited oModel and pass that info along to the composited view_mc. This allowed me to have different views listening to the model and each requesting only the info they needed instead of getting all-or-nothing. When my model's data changed, it all changed but all of it's listening views didn't need all of the data. I like that idea too. It's close to Moock's MVC with Observer Pattern passing only the needed data is really cool. /Johan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Questions Using MVC Pattern with Flash
I think I get the idea, relax about MVC... but not too much ;). Starting out with MVC is kind of like having ten different maps that all get to the same place by different paths. Because of my own specific application needs, certain implementations (or maps) will be much better than others and figuring out which one to use is mind-boggling. Even worse, doing it with Flash is like having an extra mountain range (or something) smack dab in the middle. Taking Mikes suggestion I'm looking into ARP more. It looks pretty good but its kind-of a learning curve. I think the framework will help filter out some of the options. Anywhoo, thanks for your guys' help! I'm sure I'll feel better about this whole thing once I start actually making some progress ;). Best, Brent Message: 21 Date: Wed, 9 Nov 2005 19:58:14 + From: Johan Lopes [EMAIL PROTECTED] Subject: Re: [Flashcoders] Questions Using MVC Pattern with Flash To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 I've tried building the view completely by the controller with AS createEmptyMovieClip and such but was wasting too much time not being able to see anything at design time. I've stayed away from that too. This approach is advantageous when you're working with designers who wants to have full access to your views during design time. I chose not to pass event objects but rather fire a generic onUpdate() event on each listener. Inside oController.onUpdate() I request the info I need from the composited oModel and pass that info along to the composited view_mc. This allowed me to have different views listening to the model and each requesting only the info they needed instead of getting all-or-nothing. When my model's data changed, it all changed but all of it's listening views didn't need all of the data. I like that idea too. It's close to Moock's MVC with Observer Pattern passing only the needed data is really cool. /Johan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders