Recent Entries
- Email Hijacked?
- CFUnited: Refactorin...
- CFUnited: Continuous...
- CFUnited: Prototypin...
- CFUnited: All about ...
- CFUnited: Event Driv...
- CFUnited: Integrated...
- CFUnited: ColdBox Fr...
- CFUnited: Design Pri...
- CFUnited: Automating...
Popular Entries
- Import/Export in SQL...
- SAML and ColdFusion ...
- SAML and ColdFusion ...
- SAML and ColdFusion ...
- Improving Performanc...
- SAML and ColdFusion ...
- SQL Server 2005 Expr...
- SAML and ColdFusion ...
- Second Blog CFC Surv...
- Learning Flex
Top Commenters
- Nathan Mische (11)
- CFdevfusion (6)
- CFFusionDev (5)
- Peter Bell (4)
- Sean Corfield (3)
- Rey Bango (3)
- Terrence Ryan (3)
- Scott (2)
- Jim Priest (2)
- David (2)
Slideshows
Pool Surprises...Sponsored Links
Search
Subscribe
Enter your email address to subscribe to this blog.RSS
Tags
cfug cfunited coldfusion flex generalArchives
- Adobe (5) [RSS]
- AIR (6) [RSS]
- ASP.NET (2) [RSS]
- BlazeDS (1) [RSS]
- Books (1) [RSS]
- CFEclipse (5) [RSS]
- CFML (0) [RSS]
- CFUG (26) [RSS]
- CFUnited (23) [RSS]
- ColdFusion (53) [RSS]
- College Football (3) [RSS]
- Conferences (1) [RSS]
- Development Tools (3) [RSS]
- DIY (1) [RSS]
- Eagles (3) [RSS]
- Fireworks (1) [RSS]
- Flash (3) [RSS]
- Flex (10) [RSS]
- Flyers (2) [RSS]
- Frameworks (5) [RSS]
- General (28) [RSS]
- Hockey (2) [RSS]
- Hosting (1) [RSS]
- House (2) [RSS]
- HTML (2) [RSS]
- JavaScript (1) [RSS]
- Jobs (1) [RSS]
- Macromedia (0) [RSS]
- Misc. (5) [RSS]
- Model-Glue (4) [RSS]
- Navy Football (5) [RSS]
- onair2007Philadelphia (3) [RSS]
- onairbustour (3) [RSS]
- Open Source (0) [RSS]
- Other (1) [RSS]
- Other Sports (4) [RSS]
- Performance (3) [RSS]
- Personal (2) [RSS]
- Phillies (2) [RSS]
- Projects, User Group Manager (1) [RSS]
- Rant (1) [RSS]
- Rants (1) [RSS]
- SAML (6) [RSS]
- Site (1) [RSS]
- Soccer (4) [RSS]
- SQL Server (2) [RSS]
- Transportation (1) [RSS]
- Wedding (2) [RSS]
AGGREGATORS
CFUnited: Event Driven Programming
Posted On June 25, 2008 10:20 AM By Phil in CFUnited
I'm going to try and finish up all my posts/reviews from CFUnited today and tomorrow. Essentially, I have the Saturday sessions to wrap up and then probably a final wrap-up from my experiences at the conference as a whole. Anyways, I got up early on Saturday to attend Sean Corfield's Event Driven Programming session. Essentially, Sean delved into a topic that is somewhat foreign to CFML developers, but is heavily used in the RIA space (Flex primarily but also in AJAX). CFML, by its nature (even if you use OO concepts) is procedural in nature. While Sean did show is new framework, Edmund, much of his talk centered on the types of thinking needed to institute and design for an event driven architecture. I have mentioned this a few times both here and to others, I didn't really understand the event aspect of Flex until I developed a few ASP.NET applications. For some reason, and it may have been the code-behind inherit in ASP.NET and VisualStudio, but I finally "got it" after doing those projects. It did help me to understand how I needed to think about "events" within a page and its response. I look forward to seeing more of Sean's Edmund framework. Here are my notes from the presentation:
What we're used to
- responding to method calls
- responding to clicks
- the richer the UI, the more we have to deal with interactions, often asynchronously - it's a different way to program
- Asynchronous event handling is foreign to most CF developers (me included!)
Event-Driven Architecture
- event: "a significant change in state" - other definitions on wikipedia.org, but they're more formal
- goal: decouple components - registering to events and reacting when broadcasted (i.e., a user logs in)
Event-Driven Lifecycle
- Components are registered as event handlers - expressing interest in specific events
- Events enter the system - from external systems but can also be the result of internal operations
- Events are dispatched to interested handlers - handlers register for a given event and are executed
- nice diagram, should be on the Connect recording
Event-Handling by Configuration
- Explicit declaration of handlers for events - Mach-II, ModelGlue, HTML/JavaScript (event handlers on various tags), Flex (similar to HTML with event handler attributes in MXML tags)
Event-Hnadling by Convention
- Implicit association (ColdBox, Fusebox 5.5)
- handlers are methods on CFCs that are auto-discovered via a naming and location conventions
Event Handling Dynamically
- Association of handlers and events at runtime (AJAX, Flex)
- AJAX - limited one to one
- Flex - can do more than one and even custom events
Back to ColdFusion
- application frameworks get part of the way there
- declare in XML, not code, nor dynamically add listeners
- we can announce new environments dyncamically
- mostly synchronous
Edmund
- Event-Driven model framework focused on event handling with asynchronous execution
- Event handlers: can be declared in XML, registered dynamically, and be synchronous or asynchronous
- Flex style event handling
- Register a listener for an event (edmund.register("eventName", someObj); someObj.handleEvent(event) is called
- Can specify additional arguments
- Announcing an event - edmund.dispatch("eventName"); anEvent = edmund.new().name("anotherEvent"); edmund.dispatchEvent("anotherEvent");
- Can specify data for events - allows for separation of data and only providing the event with needed data
- has a declarative way of defining data/properties
- create custom events - <cfcomponent> extends "edmund.framework.Event" and then e = edmund.new("events.MyEvent")
- does speak some Mach-II and ModelGlue to make transitions easier or place nicer together
Edmund Workflow
- Has workflow components that implement handleEvent() mothod
- decision, foreach, seq functions (and more on the way0
- built off of work done for a client (or at least made him think about)
- Command pattern objects
- ColdSpring workflow XML is crazy, I can see why in the earlier session Chris Scott said "whoah, I didn't know ColdSpring did that". Sean's doing stuff with ColdSpring I've never really seen before.
- allows for complex event handlers declaratively using ColdSpring
Bubbling events
- idea of "parent" events, register relationships when registering
- can programatically determine whether to bubble the event up using bubble() method
Summary
- Event-Driven Programming allows to create flexible, loosely coupled systems
- apply same approach in CF that we see in Flex
- allows for CF programmers to learn event model used in Flex while working in language already known
- project on RIAForge and Google group mailing list
- general note on the way Sean does programming is that he returns the
object on "set" type functionality as opposed to void so it makes
chaining easier. Allows for more declaritive style of programming and
also makes integration with ColdSpring easier
- one thing I have noticed with some of the presentations is how much some of the stars of the community think at a much higher level than us "padiwans". Dan Vega and I were talking about how going to some of these sessions, we feel we're at a higher level than we think, but then I go to something like this presentation from Sean and realize, as a programmer, I have a ton of room to grow as a developer.


philduba.com




Comments
I like to live by the mantra "Learn something new every day" and I'm pleased that after about 25 years of doing this stuff, I'm still able to learn new things from the people around me and the community.
I agree that examples would help others "grok" the article better so I may yet create them. I may even turn the article into a preso (and have to do code samples for that).