Aliaspooryorik
ColdFusion ORM Book

Comparing ColdBox and Fusebox

I firmly believe in using the right tool for the job and wanted to check out ColdBox properly. I've heard good things about it and it's been around long enough to prove that it is a stable and reliable framework.

I've been using Fusebox since version 4 and have found it to be an really good framework and the recent no XML version has really speeded up the development process. So converting a Fusebox application (which uses ColdSpring) to ColdBox seemed like a good place to start. Here are the basic comparisions between a Fusebox XML, Fusebox no XML, and ColdBox controller (or event handlers in ColdBox).

Fusebox traditional Controller (Fusebox 4 onwards)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit>
<circuit access="public">
<fuseaction name="List" access="public">
<if condition="#StructKeyExists(attributes, 'user_id')#">
<true>
<set name="reminder_user_id" value="#attributes.user_id#" />
</true>
</if>
<set name="qReminders" value="#application.beanFactory.getBean('TodoService').getReminders(attributes)#" />
<include circuit="vReminders" template="dspListReminders" contentvariable="content.main" />
</fuseaction>
<prefuseaction>
<xfa name="Calendar" value="Calendar.Month" />
</prefuseaction>
</circuit>

Fusebox 5.5 introduced the cfc as circuit style


<cfcomponent output="false">
<cffunction name="List" output="false">
<cfargument name="myFusebox" />
<cfargument name="event" />
<cfif event.valueExists( "user_id" )>
<cfset event.setValue( "reminder_user_id", event.getValue( "user_id" ) ) />
</cfif>
<cfset event.setValue( "qReminders", application.beanFactory.getBean( "TodoService" ).getReminders( event.getAllValues() ) ) />
<cfset myFusebox.do( action="vReminders.dspListReminders", contentvariable="content.main" ) />
</cffunction>
<cffunction name="prefuseaction" output="false">
<cfargument name="myFusebox" />
<cfargument name="event" />
<cfset event.xfa( "Calendar", "Calendar.Month" ) />
</cffunction>
</cfcomponent>

ColdBox Controller (handler) as a CFC


<cfcomponent extends="coldbox.system.eventhandler" output="false">
<cffunction name="list" returntype="void" output="false">
<cfargument name="event" />
<cfif event.valueExists('user_id')>
<cfset event.setValue("reminder_user_id", event.getValue('user_id')) />
</cfif>
<cfset event.setValue("qReminders", getPlugin( "ioc" ).getBean( "TodoService" ).getReminders( event.getCollection() ) />
<cfset event.setView( action="vReminders/vwListReminders" ) />
</cffunction>
<cffunction name="preHandler" returntype="void" output="false">
<cfargument name="event" />
<cfargument name="action" hint="The intercepted action" />
<cfset event.setValue("xehCalendar", "Calendar.Month") />
</cffunction>
</cfcomponent>

So there you go, the styles of ColdBox and Fusebox no XML are fairly similiar so ColdBox developers, have a look at Fusebox and Fusebox developers have a look ColdBox. Learning another framework can only make you a better developer.

 


1 comment

  1. Yes, I found this very helpful. I am just learning fusebox 5 no XML and was curious about COLDBOX.
    Thanks.

    Comment by steven wolff – September 27, 2011

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts