- A fairly fundamental misunderstanding about how AJAX/Flex work
- An unnatural attachment to one and only one tool of choice
Event-Driven Model Framework?
October 23, 2007 · 26 Comments
As folks start adopting more AJAX and Flex for their applications, I see a lot of questions about "how to use <insert favorite HTML framework> to handle AJAX/Flex calls?"
This is based on two things (in my opinion - putting on my flame-retardant suit)...
Tags: architecture · coldfusion · edmund

26 responses so far ↓
1 James Marshall // Oct 24, 2007 at 1:29 AM
A unified approach would be excellent, but would you make it library agnostic or tie it to a single library (Spry, jQuery)?
2 todd sharp // Oct 24, 2007 at 5:01 AM
3 CoolJJ // Oct 24, 2007 at 5:16 AM
CoolJJ
4 Sean Corfield // Oct 24, 2007 at 6:26 AM
@Todd, it would not be an MVC framework. You could use it with any MVC framework. See CoolJJ's comment about securing remote calls.
@CoolJJ, yes, this is part of the motivation. When folks use MVC frameworks to build HTML applications, they often wire their security into that layer and then find it hard to figure out how to apply security to the service layer. If security etc could easily be wired into the service layer, it becomes more reusable (across different UI treatments).
ColdSpring's AOP and its Remote Factory go some way toward this but since people are getting used to an event-driven approach for their HTML applications (through Mach-II, Model-Glue and ColdBox) and an event-driven approach for their Flex applications and, to a lesser extent, an event-driven approach to their AJAX applications, it seems a better fit to offer a way to build rich services using an event-driven approach as well.
Keep the feedback coming folks!
5 Brian Kotek // Oct 24, 2007 at 7:50 AM
6 RyanTJ // Oct 24, 2007 at 7:56 AM
7 Sean Corfield // Oct 24, 2007 at 8:21 AM
@RyanTJ, did you read Brian's article? Yes, you can use AJAX with an MVC HTML framework to render HTML page fragments and that works really well but I'm talking about data requests. I'm focusing on the service layer (trying to make that richer / easier to build). Sounds like you have a good architecture (and one I wish more folks would adopt!).
8 Devin // Oct 24, 2007 at 8:31 AM
Nevertheless, if this is something you're thinking of building, I'd definately be interested to see what you come up with.
9 RyanTJ // Oct 24, 2007 at 9:40 AM
* if its replacing my UI controller then it may need an event to listener style setup/config. So you can define a method or cfc to run.
* a service locator method (for getting model/services rather than wiring) Like we use one to get ColdSpring beans.
* a global on request start/end style method.
* a global error handling or error object.
* Not sure but a data formatting/serialization method may be needed.
So maybe some flow like: request start, listener, data formatter, request end. With things like the error handler and service locator being done as needed.
I hope this helps.
10 Sean Corfield // Oct 24, 2007 at 9:56 AM
It would not replace your controller - but your controller could talk to it (it would sit between your MG code and your business model).
Yes, it will need some sort of event/listener config, either programmatic or XML (or convention based).
A service locator is a good suggestion - I'm still on the fence about that.
Global request lifecycle processing is likely (I would probably want to hook into Application.cfc).
The flow would be less procedural - everything would be triggered by events (some "system generated", some application generated).
Good feedback, thanx.
A bit more background: this will almost certainly be CF8-only (because I think I need both threading and onMissingMethod() for what I have in mind - perhaps Railo can support this, not sure whether New Atlanta are adding onMissingMethod()?). The event model will support synchronous and asynchronous operations.
11 Dan Wilson // Oct 24, 2007 at 11:04 AM
I would prefer a consolidated community approach to this as I think it would help ensure overall software quality, level the playing field for newer folks and further encourage best practices in the community.
I would also be willing to donate time and effort to the cause.
DW
12 Daniel D // Oct 24, 2007 at 12:58 PM
13 Nathan Strutz // Oct 24, 2007 at 1:24 PM
I can't say I'm terribly interested in another framework, unless it brings something truly unique to the table. This project sounds like a great add-on package or plug-in to the existing frameworks. Somewhat side-by-side makes sense to me, so I could have a controller for my HTML output and a controller for raw data output, so the two wouldn't have to be far apart, written in separate frameworks.
At worst, this would be a forked framework project. At best, it would be a best practices document, basically, no code written, and extensive horn blowing for how to use something like ColdSpring's remote stuff and tie it in with your application.
14 Sean Corfield // Oct 24, 2007 at 2:01 PM
@Nathan, that's good feedback and I do see it more as something to be used with other frameworks rather than replacing any of them. I'm hoping that it will be a relatively small amount of code and, perhaps, more "architecture". I guess the question is whether you feel that there is a problem to be solved for backending Flex and AJAX apps?
@All, if you are interested in discussing this in depth and/or contributing to the project, please join the Google Group. Having said that, feel free to continue to comment here if you just want to express an opinion or ask for clarification and don't feel the need to get more deeply involved (yet!).
15 Devin // Oct 24, 2007 at 3:59 PM
Sure, I'm a cf developer as well ( even though I haven't touched it in almost a year while transitioning to primarily a Flex dev ), so my only interest in CF anymore is nothing more then a backend to a Flex app. With that being said, I'd much prefer a framework that was meant and built specifically for what I was intending to use it for.
And as for making it an extension to an existing framework, such as MII/MG, I hate for people to be forced into learning those simply for the access to the extension, especially when they have no desire in building html apps.
16 Sean Corfield // Oct 24, 2007 at 4:21 PM
You can also learn - and use - ColdSpring (or LightWire or Transfer or Reactor) in isolation from the other frameworks.
When I said "I do see it more as something to be used with other frameworks rather than replacing any of them", I meant it in the same way that CS, LW, R and T work rather than "extension to an existing framework".
17 Brian Meloche // Oct 24, 2007 at 7:40 PM
Yeah, I'm in. I am not 100% convinced existing frameworks can't be used in this way (I've already done this a lot with AJAX and Mach-ii), but I am interested to see if we can come up with something that is made to work with AJAX and Flex with APIs. A sort of MC framework with APIs, as opposed to MVC.
18 Sean Corfield // Oct 24, 2007 at 10:03 PM
19 Brian Meloche // Oct 25, 2007 at 4:29 AM
20 Zach // Oct 25, 2007 at 5:06 AM
21 Sean Corfield // Oct 25, 2007 at 10:06 AM
@Zach, thanx. Yes, that is my feeling too.
22 Brian Meloche // Oct 25, 2007 at 2:06 PM
23 Sean Corfield // Oct 25, 2007 at 2:19 PM
24 sal // Oct 25, 2007 at 5:31 PM
cheers
actually would rock my current app, in which I've been wanting to implement some flashy flex charts...
:-)
25 Matt Quackenbush // Oct 26, 2007 at 7:44 AM
26 Patrick Whittingham // Apr 9, 2008 at 6:55 AM
I think an CFMX Ajax/Flex framework would be a good starting point. Since Ajax been around since IE 5 and many other Ajax frameworks beside Adobe's should be allowed. This framework should work with 'all' of the popular frameworks together w/Flex.
Leave a Comment