Mark Drew (Redux)- cf_etc...

a compendium of railo, cfml, cfeclipse and technology topics

Mark Drew (Redux)- cf_etc...

Model Glue Tips Part 2: Use Naming conventions for your Event Handlers.

August 11, 2007 · 4 Comments

Continuing from the previous post, I wanted to talk about naming conventions, I am sure everyone has a way of doing this and will argue (a bit like IDE or OS wars) till they are blue in the face. This is the way I try and do it, maybe because I started out using fusebox, but it makes sense to me. If you have split out your Model Glue file as mentioned in my previous post, you will already have event-handlers that deal with different areas of your application, why not do the same with the event handlers, then you can see exactly what you are dealing with. For example, if we are doing Security related functions (in my ModelGlue_Security.xml file) it makes sense to name the event-handlers something like "security.dologin" or "security.dologout" then you will be able to see exactly what part of the application you are dealing with. I hope this makes sense and is useful!

Tags: model-glue

4 responses so far ↓

  • 1 sal // Sep 22, 2008 at 4:13 PM

    part 3 coming up? perhaps some subapplications??

    ;-)

    good series.

    cheers
  • 2 Mark Drew // Sep 22, 2008 at 4:13 PM

    I might touch on that, but I just wanted to give some tips, rather than some major insights in this series :)

    MD
  • 3 johann // Sep 22, 2008 at 4:13 PM

    I completely agree with a good naming convention for your event handlers. In the MG app that I work on every day, there are many "sub apps" within it and I don't know how we would have kept track of all the events without a naming convention like you mentioned. Also, we would probably have collisions on duplicate event names if we did not have a naming convention.

    johann
  • 4 Mark Drew // Sep 22, 2008 at 4:13 PM

    Naming conventions are indeed a "Good Thing (tm)". I think the first time I encountered this kind of thing was in Fusebox, of course it used the <circuit>.<fuseaction> which meant there were no collisions since it was all based on switches (and you cant have two case statements for the same variable)

Leave a Comment