January 7, 2008
Day 3 was a bust. The power went out due to severe storms around 11am and I went home before going to my dad’s 60th birthday party that night. We drove my girlfriend’s Audi A3 on backroads as we navigated around a flooded highway. Thankfully there were other cars in front of us because we weren’t sure how deep the water was and I didn’t want to be that guy on the news standing on his hood being rescued by a helicopter. My friend took this picture in Tahoe over the weekend showing the snow dropped by the storm. Crazy weather!
Findings Today
- SES URLs – There are none. You have to set it up yourself. I created an actionpack to handle it which you can download here. It solves the problem of generating and parsing search engine safe URLs in model-glue with the viewState.getValue(“myself”) without hacking the core files. You can disable the parsing via a ColdSpring parameter if you have something like Apache’s mod_rewrite or an IIS ISAPI filter.
- Using onQueueComplete – Talking with Sean, he suggested putting a utility library into the event object using onQueueComplete as a way of avoiding the temptation of accessing it via arguments.event.getValue() in a controller. A nice tip to keep yourself honest.
- Periodically review your Transfer.xml – I wrote my transfer.xml a few months ago but am only starting to use it now. I spent a good hour setting up controllers for other data members like “club” that were accessible all along via Transfer relationships like member().getClub(). It pays off to have that fresh in mind as you’re starting.
Questions Today
- Can I change the model from the view? – I have a messaging component that stores generated messages like “Success!” and then spits them out. In my old app, it was just a toHTML() method that I used and then promptly clear() the messages. The catch is that I can’t use onRequestEnd to clear them because they should only be cleared when they’ve been displayed and it could be a redirect or something where they aren’t immediately spit out. So in my view, I’ve got:
<cfset msg = viewState.getValue("msg").get() />
<cfif arrayLen(msg)>
... output messages to user ...
</cfif>
<cfset viewState.getValue("msg").clear() />
So the view is telling the model to clear the messages (because they have been displayed). Any alternative ideas or is that OK? - Event Naming – I need a better event naming scheme. Dan Wilson said he puts “do” in front of his persistent event names. Does anyone have a clever scheme they are happy with and promotes organization? I’m particularly interested in how to name/organize a typical workflow like list objects, display single object, edit object, save object, edit object success, edit object failure (in cases where they don’t go back to the original). Any suggestions?
Resources Today
- Joe Rinehart’s post on SES URLs, Sean Corfield’s SES.cfm post and Ray Camden’s SES post
- I’m thinking more about validation… Validat, EventValidator, Andy Jarrett’s approach. Most object validation occurs in my beans (decorators via Transfer) but there are other things that need validation as well. Non-object UI for example.
Comments are closed.