An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries for month: August 2007

CFUNITED Express Bay Area - November 9th (updated)

August 29, 2007 ·

The pricing appears to have changed back to the previous values... $349 through September 30th and $450 thereafter.
CFUNITED Express comes to the Bay Area on November 9th at the JW Marriott in San Francisco. Speakers include Charlie Arehart, Michael Smith, Shlomy Gantz, John Paul Ashenfelter... and me! If you register before October 31st, you can use 100% of your registration toward CFUNITED 2008 (just 50% after that).

Tags: coldfusion · cfunited08

iHeart iWork 08

August 28, 2007 ·

OK, so many of you already think I'm an Apple fanboi but I've resisted Pages and Keynote in the past because they're every bit as proprietary as Microsoft's bloatware Office product. I have diligently stuck with NeoOffice/J - free, open source, open standards. It's a bit clunky but it works. I've used it for years. I helped (a little) with the Mac OS X port of OpenOffice.org back in the 1.0 and 1.1 days. I've always felt it's quirks are worth putting up with for the karma of Free Open Source and Standards. I'm putting together my presentation for MAX and trying to work with Adobe's PowerPoint template. Someone really needs to teach those Adobe folk how to use PowerPoint! The template is horrific to work with and, unfortunately, exceeds the abilities of NeoOffice/J. It's all been very frustrating. So, Apple released iWork 08 and it claims great Microsoft compatibility. Everyone is ooh-ing and aah-ing over the new features and the all-new Numbers spreadsheet. I'm thinking "yeah, whoop-di-do, another proprietary app". Eventually... Well, I decide to at least download it and try it out. I open up Keynote and open up the Adobe PPT file. Perfect rendering. Wow! I create a few new slides and reorder them. Everything. Just. Works. OK, I'm impressed... so I open up Numbers and bring in my invoicing spreadsheet. Ooooh, I think I'm going to faint! A spreadsheet actually looks attractive! And guess what? It. Just. Works. Damn. I guess I'll be buying Apple's proprietary office suite after all. I'm stunned at how good it is. I love Free Open Source software and I'm willing to cut it a lot of slack but Apple has really hit the nail on the head here and the suite is definitely worth the $79 entry fee...

Tags: oss · osx

Mock Objects with onMissingMethod()

August 28, 2007 ·

Brian Kotek has created a Mock Object factory that uses onMissingMethod() to automatically create mock versions of your objects for use in unit testing. He explains the technique well and shows several great examples. Another very powerful use of onMissingMethod().

Tags: coldfusion

Automatic Transactions with onMissingMethod()

August 28, 2007 ·

More fun with onMissingMethod(). I'm just going to show a component, an example and the output... Transaction.cfc - the output is just for debugging to show what is happening:
<cfcomponent output="false">

   <cffunction name="init" returntype="any" access="public" output="false">
      <cfargument name="obj" type="any" required="true" />
      <cfargument name="suffix" type="string" default="WithTransaction" />
      
      <cfset variables.obj = arguments.obj />
      <cfset variables.suffix = arguments.suffix />
      <cfset variables.suffixLength = len(variables.suffix) />;br>       
      <cfreturn this />
      
   </cffunction>
   
   <cffunction name="onMissingMethod">
      <cfargument name="missingMethodName" />
      <cfargument name="missingMethodArguments" />
      
      <cfset var result = 0 />

      <cfif len(arguments.missingMethodName) gt variables.suffixLength and
            right(arguments.missingMethodName,variables.suffixLength) is variables.suffix>

         <cftransaction>
            <cfoutput>---Begin Transaction<br /></cfoutput>
            <cfset result = variables.obj.call(
                  left(arguments.missingMethodName, len(arguments.missingMethodName)-variables.suffixLength),
                  arguments.missingMethodArguments) />

            <cfoutput>---End Transaction<br /></cfoutput>
         </cftransaction>
      <cfelse>
         <cfset result = variables.obj.call(arguments.missingMethodName, arguments.missingMethodArguments) />
      </cfif>
   
   </cffunction>

</cfcomponent>
Example code - Test.cfc:
<cfcomponent output="false">
   <cffunction name="doSomething">
      <cfoutput>Test.doSomething<br /></cfoutput>
   </cffunction>
</cfcomponent>
Example code - index.cfm:
<cfscript>
   o = createObject("component","Test");
   t = createObject("component","Transaction").init(o);
   // call bare method:
   o.doSomething();
   // call method via transaction proxy:
   t.doSomething();
   // call method via proxy with automatic transaction:
   t.doSomethingWithTransaction();
</cfscript>
Output:
Test.doSomething
Test.doSomething
---Begin Transaction
Test.doSomething
---End Transaction
The call() method is a bit of magic I have in my base component.cfc file. I'll post that in due course with full documentation...
Bug: onMissingMethod() should end with:
<cfif isDefined("result")>
<cfreturn result />
</cfif>

Tags: coldfusion

Model-Glue Broadcast/Listener for Mach-II

August 28, 2007 ·

I was experimenting with onMissingMethod() last night in a Mach-II listener and created a controller/listener that lets you implement the Model-Glue style of decoupled broadcast-listener semantics within Mach-II. Let me explain... In Mach-II, inside an event handler, you notify a specific listener to execute a specific method. In Model-Glue, inside an event handler, you simply broadcast a message and any listeners that have been declared for that message are executed automatically by the framework.

[Read more →]

Tags: coldfusion · machii

INSPIRE - MAX Europe

August 28, 2007 ·

If you can't make MAX in Chicago, you'll get another chance to see my Design Patterns and ColdFusion INSPIRE session in Barcelona. Tuesday, October 16th, at 4pm. See you in Europe?

Tags: coldfusion · adobemax07

Mach-II is all grown up!

August 27, 2007 ·

If you've been following my blog over the years, you'll know that I pretty much stopped using Mach-II a few years ago, switching to Model-Glue instead (and, of course, continuing to use Fusebox for a variety of projects as well). At the time, I felt Model-Glue had leapfrogged Mach-II - as each new framework might be expected to do to existing frameworks - and I liked it's built-in bean factory and cleaner implicit invocation mechanism. Model-Glue has come on in leaps and bounds - the rearchitecture based on ColdSpring, the scaffolding infrastructure, the integrated support for Reactor and Transfer for "generic database messages". It's very impressive. And now we're got the beginnings of a Flex version, which is very promising. Now that I'm consulting and have a number of clients, I'm encountering Mach-II quite a bit and looking at the 1.5 release. I've mentioned in the past that I think 1.5 looked quite impressive (when Peter Farrell gave the "what's new?" talk at cf.Objective(), for example). Recently, I've been making recommendations for frameworks for clients and finding myself recommending Mach-II for some clients, mostly due to the new features in 1.5. For some of the sites my clients are trying to build, the modules, includes and subroutines really do allow you to build much larger, much more modular sites than earlier versions of Mach-II. The extended property semantics in Mach-II 1.5 are also very nice, allowing you to specify structured configuration data - including full-on CFCs - as well as allowing property values to be dynamically substituted into parameter values throughout the configuration. I still don't really like the direct invocation model (with <notify>) compared to Model-Glue's broadcast / listener mechanism, but the other features are pretty compelling. One thing I have seen mentioned, but cannot find, is Peter Farrell's new ColdSpringProperty CFC, to replace the old ColdSpringPlugin. Anyone know where to get a copy?

Tags: coldspring · machii

CFEclipseFacade moved to Google Code

August 22, 2007 ·

I just added my cfcUnit facade code into my Google Code project that already contained Closures, Concurrency, IRCBot and Scripting. Rich Kroll sent me a nice little fix for a bug in the facade so I figured it was a good time to move that file under version control and make it part of my regular builds process. Feel free to file bugs and enhancements in the issue tracker - and thank you for using my code!

Tags: cfeclipse · coldfusion · oss

BACFUG Announcements Mailing List

August 21, 2007 ·

There is now a separate announcements-only mailing list for BACFUG that will be used for meeting announcements and other special notices. You can subscribe by sending an email to: bacfug-announce-subscribe@vfive.org You cannot post to the list - it is announce-only for myself and our listmaster Brian Ghidinelli who graciously hosts the lists. If you are already subscribed to the BACFUG discussion list (see the contact page on the BACFUG website, then you have been subscribed to the announcement list (and should have received an initial announcement already).

Tags: coldfusion · bacfug

ColdFusion 8 and ActiveMQ JMS

August 20, 2007 ·

ColdFusion 8 includes two example JMS event gateways. It includes the original JMS event gateway that I wrote as part of CFMX7 and it now includes an updated JMS event gateway that adds a number of new features, such as transacted message consumption, 'map' messages, message properties and message selectors and support for both topics and queues. The original gateway type is called "JMS" and the updated gateway type is called "ActiveMQ". It isn't really specific to the Apache ActiveMQ JMS server but it was developed for a project that used that. The ActiveMQ JMS event gateway is based on the original JMS event gateway but is not entirely backward compatible. In order to implement some of the new features in a nice, clean way I had to rename some of the configuration parameters and change the event data structure passed into CF by the gateway. On the plus side, there is actually a "developer's guide" PDF for the new ActiveMQ gateway (in WEB-INF/cfusion/gateway/docs) that documents all of the data structures and configuration file parameters. If you're considering JMS as an integration technology (and I highly recommend doing so if you need reliable, asynchronous communication between backend systems) then you should look at ActiveMQ (it's free open source) and ColdFusion 8's new event gateway.

Tags: coldfusion