|
Viewing By Entry / Main
3 May 2007
MVC From First Principles - Video on onflex.org
Hey there! Do you feel that when people start discussing architecture patterns, model view controller and the like it's as if you've walked in on a conversation and you've missed a few vital bits at the start?
If this sounds like you, relax. Grab a coffee and check out the latest addition to video.onflex.org - my webDU presentation "Easy as MVC: Architecture and Frameworks for Non-Believers". I've been working on this presentation in one incarnation or another for a few years now and the explanation of dependencies and how they lead to MVC seems to be striking a chord with a lot of people. Many thanks to Mike Chambers and Ted Patrick for making this available to everyone. Watch the video, or see the slides for this presentation here. Cheers, Robin
Comments
This is on my list of things to watch!
been waiting for this for a while! Thanks!
Can I borrow your brain when you're not using it :) You have so much good experience building such a large application in Flex that I envy you. In your presentation you show what your project directory structure looked like for this project. Is there any way you can post a screen shot or blog on organizing large projects with Cairngorm?
Hi Michael,
Basically the application package (e.g. com.fairfax.afr) follows the standard Cairngorm package structure - business, commands, control, model, view, vo - but with additional folders underneath each to break the classes up by functional area. There were also a few util packages - com.rocketboots.util for those we use across projects and com.fairfax.util for some support classes owned by the client. The only other hints for a large project would be to keep your controller addCommand() calls alphabetically sorted (you get lots of merge conflicts on a busy project, and keeping it sorted makes merges much easier) and remember that just because you're using a framework, you don't have to stop thinking like a technical architect - you'll still have potential change to isolate and bad dependencies to avoid. Oh, and don't write off View Helpers - they seem to have passed out of favour with the Cairngorm community, but they worked fine on our project. AFAIK your commands either depend on a list of model properties or a list of view helper methods to update the view. The nice thing about methods over properties is that we can define an interface , e.g. commands.ISearchViewHelper, and then have concrete view helpers in the views package that implement one or more of these interfaces. This gave us some really useful flexibility, allowing views from many parts of the UI to work with (for example) our search commands. Cheers, Robin
MVC is complicated in that it's not sufficiently layered for some situations. It was created as an OO concept that looks at OO as a foundation rather than at tool. (Not to mention it should be called CMV since the controller is where things begin.)
On web apps you need to separate content from presentation. Failure to do so prevents skinning which is a big issue when it comes to code reuse. IF you have to recode an app to install it on a different site, then the reuse goal of OOP falls apart in the view. What is needed is a more defined separation of content and presentation. If the presenting of the content is divided from the content then and only then is this viable. NOTE: CSS doesn't have a the ability to handle complete senarios of changing look on it's own. The foundation of CSS in layout is the DIVs and SPANs. Therefore you still need to have more control for different looks on web sites if you are going to truely personalize them without recoding the apps themselves.
|
|
|||||||