December 27, 2002

MVCF Revisited

Back in August, I blogged a reference to Benoit Hedard's MVCF articles - a look at applying MVC to ColdFusion MX. I said back then I would some day take the time to read and review his articles in more depth. Today is, finally, that day.


Benoit starts off by showing an example of fairly typical spaghetti ColdFusion code that mixes business and display logic on each page and gradually refines this code, over about half a dozen pages, to something represents a reasonably clean MVC implementation. He roughly partitions his MVC approach into:


  • Model: CFCs - business logic and objects

  • Controller: CFMs - control logic

  • View: CFMs - presentation logic and HTML

All supported by a UDF library across all tiers and some custom tags. It's nicely summed up in this diagram. Benoit approach deals with real-world issues of configuration, caching and i18n (internationalization). Without trying his approach out in a real application, I can't speak to the actual scalability, but it seems to be fairly well thought out. I would probably use CFCs more extensively, delegating parts of the presentation logic and control logic to them as well but that's more my OO background showing through I suspect, rather than any pragmatic ColdFusion experience. Probably the one thing I would take Benoit to task over is his use of Hungarian prefix naming conventions - something I feel very strongly about: it breaks encapsulation by announcing to the world the implementation type of a variable. If you later change the implementation, you either have to change every instance of the variable name or let the code tell a lie - neither option is good for maintenance! On the plus side, I particularly like his study of what he calls "pagelets" and the granular caching he provides for them. He leverages the new cfimport syntax to create clean, readable code. His separation of presentation logic from generated HTML is not perfect - although it will clearly be good enough for many applications - and this shows when he tries to create pagelets that can generate WML as well as HTML. This is a case where I'd separate WML generation from HTML generation physically (i.e., put them in separate files) and also separate the actual presentation logic physically as well. But that's a relatively minor criticism considering how much of an improvement his MVCF approach is over unstructured CFML code.


Is it a framework? No, you still need to build almost all of the application yourself. Is it a methodology? Yes, I think it can be classed as a methodology although it only covers the structure of your code, rather than any grander design considerations for your application as a whole. Is it an architecture? Not really - it doesn't address the 'bigger picture'. Is it a set of best practices? Well, that's what it claims to be and I think it serves that purpose admirably.

Posted by seancorfield at 04:35 PM | Comments (0) | blogging

December 22, 2002

Happy Holidays!

Friday, December 20th finally rolled round and Macromedia effectively closed for the holiday break so I'm enjoying some well-earned rest. That said, I've still been upgrading servers over the weekend (installing JVM 1.4.0_03) but it will mostly be a week of rest. My wife & I are off to see "Lord Of The Rings: The Two Towers" this afternoon. It's our third anniversary so I shouldn't even really be blogging!
To come as I get more time to write: my experiences with installing and configuring CFMX for J2EE - multiple instances of CFMX, clustering, session replication & failover, load testing...

Posted by seancorfield at 01:37 PM | Comments (0) | TrackBack | personal

December 18, 2002

MXDU

MX Down Under draws near: February 19-20, Sydney, Australia. I think it will be an excellent conference with some really interesting sessions.

Posted by seancorfield at 11:30 AM | Comments (0) | mx

December 17, 2002

MX Tips

Check out Daemon | Tips & Tricks for a useful (and growing) library of helpful tips for building MX applications!

Posted by seancorfield at 04:07 PM | Comments (0) | mx

December 16, 2002

Flash Remoting for CFers

Quite a few ColdFusion developers have expressed an interest in learning Flash Remoting but have pointed out a lack of good tutorials. Lucas Sherwood addresses this in his article Macromedia - Designer & Developer : A ColdFusion Developer Teaches Flash Remoting Basics Through Examples.

Posted by seancorfield at 07:11 PM | Comments (0) | cf

CFMX for J2EE

Some folks may know that I've been very busy recently reconfiguring my team's servers to use CFMX for J2EE and experimenting with configurations. I can't say too much about some of the specifics that I've been doing just yet but here's a great article by Brandon Purcell that should give you an idea of why I'm doing this! Macromedia - Designer & Developer : Advantages of Using Multiple Instances for ColdFusion MX for J2EE

Posted by seancorfield at 07:06 PM | Comments (0) | TrackBack | cf | j2ee

December 13, 2002

Flash Player 6

The latest version of the Flash Player is now available from the Macromedia Flash Player Download Center. This is the first version 6 release for Linux and brings many new features to the Netscape plug-in and the Mac as well. I've played around with it internally for a while and I really like the possibilities offered by the transparent window-less mode that is now available on all platforms! Download it today!

Posted by seancorfield at 10:43 PM | Comments (0) | macromedia

BlueDragon

NewAtlanta's Vince Bonfanti gave an interesting presentation at last night's BACFUG: An Introduction to JSP for CF Developers. I am somewhat familiar with JSP but to see a side-by-side comparison like this was enlightening, especially the section on the new JSTL specification. Vince is active in the JSP 2.0 and JSTL expert groups, as are members of Macromedia's JRun product team.
After the presentation, Vince gave a demo of BlueDragon - more or less in place of the usual Q&A session - which was also worth seeing. Vince showed how you can develop CF applications using BlueDragon on Tomcat and then deploy as a 'compiled' Web Archive file to a different J2EE application server - he took Ben Forta's CF5 Construction Kit as an example, showed it running on BD/Tomcat and then created a .war file which he then deployed to BEA's WebLogic and showed it running. Impressive. And, as I had to concede, something that is not possible with CFMX at the moment.
I had already downloaded both the Tomcat installer and the BlueDragon trial about a month ago but had been too busy to actually install either. While Vince talked, I installed Tomcat and BlueDragon on my TiBook in just a few minutes:
tar xvfz jakarta-tomcat-4.1.12.tar.gz
mv jakarta-tomcat-4.1.12 /home/tomcat
tar xvfz BlueDragon.tar.gz
cp -r BlueDragon_J2EE /home/tomcat/webapps/bd
cd /home/tomcat/bin
./startup.sh
Then hit http://localhost:8080/bd/bluedragon/admin.cfm and explored the BlueDragon administrator. Simple but effective. The developer edition pops up an alert every 20 requests which is kind of annoying but a very effective way to ensure no one tries to deploy to production!
Posted by seancorfield at 02:18 PM | Comments (0) | TrackBack | cf | j2ee

Charlie Arehart Rocks!

In response to a few questions from ColdFusion developers about Dreamweaver MX, I referred folks to the presentation Charlie gave at DevCon, in the Community Suite, called "Dreamweaver MX for Studio / HomeSite Users". It was a condensed excerpt from his one-day seminar on the subject and it was very, very good (I mentioned it in my reports
from DevCon
). Charlie has a PDF copy of the slides on his SysteManage : Presentations page. Another that just caught my eye is "Augmenting Application.cfm with Filters" where he shows how to integrate Java filters - Servlets - with your CFMX system to do some cool things, including on-the-fly compression of transmitted HTML.

Posted by seancorfield at 01:19 PM | Comments (0) | blogging

December 11, 2002

Updater 2

Read the Macromedia - ColdFusion MX Updater Release Notes for details of the latest Updater available for ColdFusion MX. There's several important fixes in this update, including a lot of database driver issues. You can get the Updater from the Macromedia ColdFusion - Updaters, Patches, and Hot Fixes Overview page.

Posted by seancorfield at 05:24 PM | Comments (0) | cf

December 10, 2002

Methodology

An interesting article on kdub's log about choosing technology and methodology based on 'best tool for the job'. Kurt Wiersma has a great mix of content on his blog covering Java, OS X, ColdFusion and PHP which are all subjects near to my heart!

Posted by seancorfield at 04:39 PM | Comments (0) | TrackBack | architecture | blogging | cf | j2ee | osx | php

December 08, 2002

Servlet -> CFML

I was intrigued by this code snippet from Matt Liotta that shows how to redirect from a Java Servlet to a ColdFusion page:


getServletContext().getRequestDispatcher("/index.cfm”).forward(request, response);

I believe Matt has suggested this idiom can be used to wrap a ColdFusion application in a Java Servlet that secures the application for licensing purposes, amongst other uses. Yet another way Java and ColdFusion are living more happily together these days.

Posted by seancorfield at 05:27 PM | Comments (0) | cf

Flash Components

This seems to be an area of interest that goes from strength to strength. I just received an email alerting me to this Component Headquarters website. I'm not quite sure what I think of the UI on the home page - more Flash than Flash - but it certainly shows the increasing popularity of Flash Components and the sophistication of some of them.

Posted by seancorfield at 05:10 PM | Comments (0) | macromedia

December 03, 2002

DWMX 6.1

Macromedia - bugs Fixed in Dreamweaver MX 6.1 should encourage you to upgrade and start using Dreamweaver instead of ColdFusion Studio! I've been using this new release internally for a while and I can definitely verify it is much more stable - and no longer rewrites code!

Posted by seancorfield at 12:13 PM | Comments (0) | macromedia