June 29, 2002

Mac OSX (continued)

The O'Reilly MacDevCenter.com currently has a series of articles about ColdFusion MX for Mac developers, which will include information on how to get ColdFusion MX running on a Mac. I took delivery of my new G4 TiBook yesterday and, like several other people, have ColdFusion MX running on it. No, it's not a supported configuration. Yes, it really works. Within a few days, I expect to retire my Windows 2000 laptop completely and be doing my ColdFusion development entirely on OSX. Am I happy? You betcha.

Posted by seancorfield at 01:55 PM | Comments (0) | osx

June 28, 2002

Coding Standards / tidy

I added some links to the ColdFusion MX Coding Guidelines so that people could find the tool tidy referred to there.

Posted by seancorfield at 12:16 PM | Comments (0) | TrackBack | cf | programming

What's in a name?

There are some restrictions on how you can name ColdFusion Components that are intended to be used as web services. Let's consider what happens when ColdFusion MX compiles your code (to Java) to use with Axis (as a web service): if you have component.cfc in {CFMX}/wwwroot/path/name/ then it will be compiled to a Java class called 'component' which lives in a Java package called 'path.name'. That means that both your component name and your directory structure should be valid names in Java. In particular, that means that you cannot create a .cfc that is named after any Java keyword (e.g., default, package) and you cannot put components in directories who names begin digits or contain non-alphanumeric characters.

Posted by seancorfield at 10:43 AM | Comments (0) | programming

Apache Security Issue

Some of you may have heard about a security flaw recently discovered in Apache. The wonderful folks at Apache.org already have fixes for this and recommend you upgrade to 1.3.26 or 2.0.39. More details can be found at CSB02-02 - Apache buffer overflow vulnerability in 1.3.x and 2.0.3x. Note that if you upgrade to 2.0.39 and you are using JRun 4 or ColdFusion MX, you will need a patch from us. Details of that can be found at MPSB02-07 - Patch available to support Apache 2.0.39 with JRun 4.0/ColdFusion MX.

Posted by seancorfield at 07:22 AM | Comments (0) | cf

June 27, 2002

blogged again!

Another worthwhile ColdFusion MX blog has appeared: CFMXPLUS by Charlie Arehart.

Posted by seancorfield at 11:58 AM | Comments (0) | blogging

June 26, 2002

DevCon 2002

Full program details are now available for the big event of the Macromedia calendar: Macromedia DevCon 2002.


Whilst DevCon will focus on design and Rich Internet Applications in general, I am presenting a much more ColdFusion MX-oriented talk, at BACFUG tomorrow (Thursday, 6.27.2002), that will focus on architectural issues and design patterns.

Posted by seancorfield at 06:03 PM | Comments (0) | macromedia

Debugging

At the beginning of this blog I recommended folks check out the new ColdFusion MX debugging machinery, especially with the dockable.cfm debugging template. Nolan Erck just noted on BACFUG that the classic debugging mode now outputs scoped variables on a single line instead of one per line like CF4.5. This is easy enough to fix: edit {CFMX}/wwwroot/WEB-INF/debug/classic.cfm and starting around line 535, add in <br> tags in each <cfloop...> just before the <cfcatch...> tag. Probably a good idea to make a backup of the file first tho'...

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

To #Pound# or not to pound?

The BACFUG mailing list has seen an interesting dialog over the last few days about certain stylistic issues (which, in fact, led to my posting our coding guidelines - see my 6.25.2002 posting) and, in particular, asking questions about when you should enclose a variable name with pound signs to force evaluation. Charles Arehart took the time to read our fine new manuals and posted a link to this very helpful page: ColdFusion MX LiveDocs : Using pound signs.


Although that is part of the ColdFusion MX documentation, similar information can also be found in the ColdFusion 5 documentation: ColdFusion 5 LiveDocs : Pound signs.

Posted by seancorfield at 10:30 AM | Comments (0) | cf

ColdFusion Studio or Dreamweaver MX?

Your choice of IDE is a very personal thing. I've used a variety of them over the years, some through company policy, some through choice, some through lack of choice. At my previous company I went from vi to HomeSite but couldn't quite make the jump to Dreamweaver (version 2 as it was back then). When I joined Macromedia, pre-Allaire-merger, company policy effectively switched me to Dreamweaver 3 then to UltraDev 4.


As internal builds of Dreamweaver MX solidified I started to use that but, well, those early builds could be a little flaky... so I installed ColdFusion Studio 4.5. For some reason, I couldn't really get on with it - it just didn't 'feel' right to me. I upgraded to version 5 but Dreamweaver MX kept getting better and better so quietly uninstalled ColdFusion Studio and never looked back.


For a lot of ColdFusion developers, ColdFusion Studio is their natural tool of choice and they make quite a few skeptical comments about Dreamweaver MX. Read Tom Muck's article Three Reasons to Migrate from ColdFusion Studio/HomeSite to Dreamweaver MX and decide for yourself. If you're a HomeSite user thinking about moving up, you might also want to read Jennifer Rowe's tutorial Migrating from Macromedia HomeSite to Macromedia Dreamweaver MX.

Posted by seancorfield at 09:50 AM | Comments (0) | cf

June 25, 2002

Open Source (continued)

Tom Harwood has released JBurg - a compiler back-end tool: a code generator generator. I can't possibly describe it in a few paragraphs so you'll have to go and visit the site!
Posted by seancorfield at 01:46 PM | Comments (0) | TrackBack | programming

Coding Standards (continued)

Last night I got permission to publish a (slightly modified) version of the Macromedia Web Technology Group ColdFusion MX Coding Guidelines. It refers to our Accessibility Guidelines which I've also published. These documents are provided as-is for the community - feel free to use them, change them, provide feedback...
Posted by seancorfield at 12:05 PM | Comments (0) | TrackBack | cf | programming

public/private (continued)

A brief follow-up to my 6.18.2002 post on the unnamed scope inside components: if you say variables.x inside a component, it will refer to x in the caller's page scope (i.e., the caller's variables.x). This is a known bug - it was intended that variables.x should refer to a private data member of the instance, just like the unnamed scope does. Do not rely on variables.x pulling x from the caller's scope as this bug will be fixed in a future release!

Posted by seancorfield at 07:26 AM | Comments (0) | cf

June 24, 2002

Coding Standards (continued)

A few days ago I bemoaned the lack of public domain ColdFusion Coding Standards. Michael Smith of the Maryland CFUG pointed me at this collection of links to ColdFusion coding guidelines. I haven't checked the links out yet - I'll save that for bedtime reading in my copious free time and follow up with some thoughts on the material linked to.

Posted by seancorfield at 02:12 PM | Comments (0) | TrackBack | cf | programming

Buying Documentation

The question recently came up: where do I go to buy the ColdFusion MX documentation set? The answer is that you can buy the documentation for $50 from our online store - here's a link that takes you straight to the Macromedia Worldwide Online Store - Documentation Set - ColdFusion MX page.

Posted by seancorfield at 08:13 AM | Comments (0) | cf

June 23, 2002

Open Source

As several people have been pointed out over the last few days, Macromedia applied to the Open Source Initiative for approval of our (draft) Open Source License. After some discussion, we've decided to go with the standard Common Public License instead of a Macromedia-specific license. Of course, there's a lot of speculation about what we might want to release as open source but right now I don't know the answer to that!
Posted by seancorfield at 11:16 PM | Comments (0) | TrackBack | macromedia

Architecture

The Macromedia DevNet has recently turned the spotlight on architecture - a subject dear to my heart - and I particularly like Jeremy Petersen's article on Benefits of Using the N-Tiered Approach for Web Applications.

Also in the architecture section are links to Ben Forta's excellent Introduction to ColdFusion Components and one of my favorite books, Design Pattern by the "Gang of Four". In my mind, this is essential reading for any developer who wants to get their teeth into OO. More importantly, ColdFusion has now reached a level where the ideas in this book can be applied in ColdFusion.

Posted by seancorfield at 05:02 PM | Comments (0) | TrackBack | architecture | macromedia

blogged! (continued)

So many good resources, so hard to find. I've added links to a variety of blogs covering ColdFusion and Flash, as well as to the other Macromedians' blogs.

Posted by seancorfield at 02:49 PM | Comments (0) | blogging

June 22, 2002

Coding Standards

These are a Good Thing(tm) so why doesn't the ColdFusion community have anything published on this? Take a look at the what the comp.lang.c++ FAQ says about coding standards - and, in particular, the list of links to the public domain (and extremely good) Ellemtel Rules & Recommendations. Unfortunately, quite a few of the links given lead to the dreaded 404... a hazard of history on the web: 'link decay'.

I'd love to see the ColdFusion community develop and publish some basic coding guidelines. My team at Macromedia has some pretty extensive coding guidelines but in their current form they contain quite a bit of Macromedia-specific information...

Posted by seancorfield at 08:39 AM | Comments (0) | TrackBack | cf | programming

June 21, 2002

blogged!

Nice to see more ColdFusion blogs springing up: cfblog.net, created by Robert Occhialini, is intended to be a "central, developer authored repository" of news and noteworthy resources; Geoff Bowers has taken on the task of editing <cfguru/> postings into a useful blog; Stephen Milligan's spikefu blog contains a lot of useful code fragments and techniques.

Posted by seancorfield at 09:57 AM | Comments (0) | blogging

June 19, 2002

More on "this"

People are asking where we've documented all this good stuff! I posted a link to documentation about the new var keywood earlier today. Here's some corrections to the documentation that clarify this scope: Macromedia: ColdFusion MX: Documentation Updates Chapter 3: Using ColdFusion Variables > About scopes. Hope that helps.

Posted by seancorfield at 10:52 AM | Comments (0) | cf

Local Variables

Another question that came up recently concerned how to declare variables inside functions that are not treated as private instance data (see public/private on 6.18.2002). As I indicated in that entry, cfset can use the new var keyword to declare a local variable. See Macromedia: ColdFusion MX: Documentation Additions for more details.


For more on this subject, see 7.4.2002.

Posted by seancorfield at 10:49 AM | Comments (0) | cf

Design Patterns

I'm a big fan of software design patterns: they really can help improve the structure of your application. With the MX release, ColdFusion now supports the expressive features necessary to take advantage of patterns that could previously only be applied to OO languages like Java, C++ and Smalltalk. To see how you can apply some of these software design patterns to your Rich Internet Application, read my article on the Macromedia - DevNet.
Posted by seancorfield at 09:07 AM | Comments (0) | TrackBack | programming

June 18, 2002

public/private

There seems to be quite a bit of confusion about how to manage public and private data members in components. In Java and C++, you explicitly declare your data members as public or private and all data is part of the this scope, with only data members declared public being accessible outside the class instance.


Things are a little different in ColdFusion. Whilst functions can be declared as public or private (or package or remote) via the access= attribute on the cffunction tag, ColdFusion doesn't really have the notion of explicit data members. What happens is that anything you store in the this scope is treated as public data and can be accessed outside the component instance, e.g., <cfset this.publicVar = "anyone can see me"/>. Inside the component instance, you can simply assign to an unqualified variable and it is treated like private data, e.g., <cfset privateVar = "hidden"/>. You can use the var qualifier to create genuinely local variables for functions, e.g., <cfset var localVar = 42/>.

Posted by seancorfield at 02:51 PM | Comments (0) | cf

cfimport

One question that has cropped up a few times recently concerns the scope of tags imported by cfimport. People want to have some sort of 'global' imported namespace, e.g., by putting cfimport into Application.cfm. You can't do that: a namespace applies only to the physical page you are on - an import inside an included file does not affect the file that includes it, nor does an import on a page affect any files included into it. I think this is a good thing - otherwise cfimport could hijack tags in unexpected ways.


There's also a good technical reason why cfimport only affects the physical page in which it appears: the CFML parser needs to know whether <tagname> is an imported tag (with an empty prefix) or a native, probably HTML, tag. It should be fairly obvious that <tagname> some content </tagname> is handled very differently when tagname is an imported ColdFusion tag as opposed to just being a tag that the ColdFusion parser can 'ignore' and pass straight through to the client.

Posted by seancorfield at 12:00 PM | Comments (0) | cf

June 15, 2002

evaluate

Often considered an 'evil' function, this has been discussed quite a bit recently on the <cfguru/> list. The first part of the thread talked about what sort of expressions are valid between #...# - you can put fairly arbitrary CF script expressions in there (unlike in CF4) but you cannot put an assignment there: #a = b + c# is an invalid expression according to CFMX, as was the case in CF5. Also like CF5 you can put an assignment statement in an evaluate() call: evaluate("a = b + c") works and returns the value of a after the assignment.


I've seen some pretty complex examples using evaluate() so I can understand why a lot of people recommend avoiding it. It's a powerful feature and, like most powerful features in a programming language, care should be exercised with it.

Posted by seancorfield at 10:21 AM | Comments (0) | cf

June 13, 2002

metadata revisited

A few people have commented that it seems strange to require an instance of a component in order to get its metadata. After all, they argue, isn't the metadata independent of any instance? Well, yes and no. Yes, strictly speaking, the metadata belongs more to the .cfc file than to any particular instance. However, ColdFusion is very much instance-based: there are no static methods or data members in components and there is no 'type' that represents the metadata itself - it's just a struct - unlike Java where you have Class within the language itself.


But ColdFusion MX is built on top of Java and inventive souls have found a way to reach into the Java layer and obtain a component's metadata without creating an instance:

<cfset instance = createObject("component","lib.mycomponent")/>
<cfset metadata1 = getMetadata(instance)/>
<cfset proxy = createObject("java", "coldfusion.runtime.TemplateProxy")/>
<cfset metadata2 = proxy.getMetadata("lib.mycomponent", getPageContext())/>

Thanx to Matt Liotta for that gem. Caveat programmer: you should not rely on the coldfusion.runtime classes too much - they are an internal mechanism and therefore not documented or supported for external use. It's still a neat trick.

Posted by seancorfield at 04:14 PM | Comments (0) | cf

June 12, 2002

Mac OSX

People keep asking about ColdFusion MX running on Mac OSX for developers. Macromedia doesn't support this configuration but several inventive souls have figured out how to get it to run. There's even going to be a series of articles soon on a well-known web site for Mac developers, praising ColdFusion MX in general and then showing how to get it running. A friend of mine has the Linux trial version running on his iMac at home - it's not fully functional (no Verity search for example) - but it's enough to build mySQL-based applications. The community seems very interested in this combination.

Posted by seancorfield at 11:13 AM | Comments (0) | osx

June 11, 2002

getClass()

In Java, you can invoke getClass() on any object to get hold of a Class object that represents the type of the object. This let's you introspect the type. ColdFusion's getMetadata() function let's you do something very similar (see 6.10.2002 entry below). However, now that ColdFusion runs on top of J2EE, you can also call getClass() on some ColdFusion objects. You can't call it on a component instance (because ColdFusion spots the attempted method call and performs a lookup within the component) but you can call it on other objects:
  <cfset a = arrayNew(1) />
  <cfset am = getMetadata( a ) />
  <cfoutput>
  a.getClass().getName() = #a.getClass().getName()#<br>
  a.toString() = "#a.toString()#"<br>
  am.getClass().getName() = #am.getClass().getName()#<br>
  am.toString() = "#am.toString()#"<br>
  <cfset s = structNew() />
  <cfset sm = getMetadata( s ) />
  s.getClass().getName() = #s.getClass().getName()#<br>
  s.toString() = "#s.toString()#"<br>
  sm.getClass().getName() = #sm.getClass().getName()#<br>
  sm.toString() = "#sm.toString()#"<br>
  </cfoutput>
This produces the following output:
a.getClass().getName() = coldfusion.runtime.Array
a.toString() = "[]"
am.getClass().getName() = java.lang.Class
am.toString() = "class coldfusion.runtime.Array"
s.getClass().getName() = coldfusion.runtime.Struct
s.toString() = "{}"
sm.getClass().getName() = java.lang.Class
sm.toString() = "class coldfusion.runtime.Struct"
However, the following produces an error ("The method 'getClass' could not be found in component"):
  <cfset x = createObject("component","lib.component") />
  <cfoutput>
  #x.getClass().getName()#<br>
  </cfoutput>
Is this useful? Maybe. It's more an artifact of how ColdFusion MX is implemented than a deliberate feature.

Posted by seancorfield at 11:23 AM | Comments (0) | TrackBack | cf

June 10, 2002

metadata

it's a very useful part of the new ColdFusion Components machinery. Calling getMetadata(this) inside a component method returns a struct that provides information about the component, its properties, its functions and their arguments. It contains all of the 'standard' tag attributes such as name=, returntype= and so on. It also contains any additional arbitrary attributes you supply such as <cfcomponent foo="bar"> - as follows:

  <cfset meta = getMetadata(this)>
<cfoutput>#meta.foo#</cfoutput>

This will produce bar as output - the new foo attribute is added to the metadata of the component.


If you cfdump the metadata, you'll see all the interesting stuff. But you can't just duplicate() the metadata unfortunately. It looks like a native ColdFusion data structure but some of the elements are actually Java objects. Most manipulations of them will work, such as accessing structure contents, but duplicate() cannot currently handle such objects.

Posted by seancorfield at 03:08 PM | Comments (0) | cf

June 02, 2002

Finally decided to upgrade Netscape

Finally decided to upgrade Netscape because 4.73 can't display this blog properly. Now I have 6.23 installed, with Flash Player 6 (r29). I was a Netscape fan up until version 3.x which was a total memory hog on the Mac so I switched to Internet Explorer. Netscape 6.23 wouldn't persuade me to switch back but at least the CFMX dockable.cfm debugging palette works properly (which it doesn't in 4.73). If you haven't tried the new debugging facilities in CFMX, you should...

Posted by seancorfield at 08:54 PM | Comments (0) | personal

Another BACFUG-related discussion (from the

Another BACFUG-related discussion (from the listserv) has been around QA and testing frameworks. Macromedia's ColdFusion team created a simple set of custom tags to make it easier to write automated tests. My team (Web Technology Group, building the next generation Macromedia web site with our MX products) uses these tags heavily to create automated test suites for all our components and tags.


I got permission from the CF QA folks to distribute them - as unsupported code - download them here. They may turn up in the Developers' Exchange at some point.

Posted by seancorfield at 11:28 AM | Comments (0) | cf

At BACFUG (Bay Area ColdFusion

At BACFUG (Bay Area ColdFusion User Group) on Thursday (5/30/2002), Nathan Dinterfass presented "What's New in CFMX?" (download and unzip it into your CFMX docroot). He did a really thorough job (which meant a very lengthy presentation) and I learned a few things about the differences between CF5 and CFMX. It was almost exactly a year since BACFUG presented "What's New in CF5?".


Afterwards, someone asked about MX tags in ColdFusion Studio - you can get the tag updaters from Macromedia's web site.

Posted by seancorfield at 11:24 AM | Comments (0) | cf

Welcome to my blog!

Everybody's doing it. People tell me I have a lot to say. I'll talk about software architecture, ColdFusion, Rich Internet Applications... I'll probably talk about Flash (I'm still learning it). I'll talk about standards and Java and C++ sometimes too. Oh, and Macromedia.
Posted by seancorfield at 10:43 AM | Comments (0) | TrackBack | blogging