CFUNITED 2008

Viewing By Category : programming / Main
January 21, 2008
Geoff Bowers has posted a helpful crib sheet on the Daemonite blog that shows how to merge branches under SVN. I do this often enough that I get frustrated with how counter-intuitive it seems but not often enough that it becomes second nature. Geoff's post definitely helped clarify things for me.


January 12, 2008
An interesting blog post aimed at helping non-programmers recognize the indicators common in good programmers. The comments are long (over 180 as of this writing!) but mostly in agreement although there are some interesting dissenters as well.

He talks through six major issues and then summarizes in positive and negative bullet points. It's not a perfect list but I agree with most of it. When I'm hiring, I look for someone who is passionate, programs in their spare time, works on personal side-projects, learns additional technologies "for fun". I want someone who has "strong opinions, weakly held" (which is a toned down version of what is presented on that blog post). Similarly, I hear alarm bells when I am interviewing a developer who views programming as "just a job", only learns new technologies when the company sends them on training courses and only knows one set of technologies. I'm less concerned (than the blog's author) about someone who started programming "late" in life.

As folks who've been interviewed by me know, I don't "quiz" people or set them "clever" tests. I get them talking about their work and their projects. I want to hear passion, I want to hear about problems and how they solved them - and how they dealt with managers (or peers) who didn't see eye to eye with them on solutions.

Are your criteria different?


November 7, 2007
If you watched this week's "Chuck", right at the end he has a C++ book on the bench and, much to my wife's amusement, I excitedly recognized it "OMG! That's Barton & Nackman's book!"

"Scientific and Engineering Programming in C++" was a landmark book that introduced powerful techniques based on templates. When we (ANSI Standards Committee) were trying to redefine the language rules around name lookup as regards the friend keyword, we were forced to preserve the examples in that book because they had passed into common usage, even though we really wanted to restrict how the friend keyword worked. We did, eventually, come up with suitable rules.

Watching "Chuck" tonight (we recorded it from Monday) brought that whole committee experience back to life for me!


June 20, 2007
Jeffrey Zeldman suggests that "maybe" is not an appropriate choice and should not be offered to users.

As someone building a social networking website, I know what he means and, whilst "maybe" was part of our earlier design, when we launch, you will only be able to say "yes" or "no" to an event. Zeldman says:

How can you know what "maybe" means? In the context of a web service, you can't.

He also rails against five-star ratings since those have an implicit "maybe" (three stars) that tells you very little.

Thoughts?


June 15, 2007
Many of us have seen the (infamous) Ruby on Rails "Blog in 15 minutes" video and probably also Joe Rinehart's "Blog in 9 minutes" Model-Glue: Unity video. It makes it all look so easy. Wow! We should all use Ruby on Rails (or Model-Glue: Unity) because it will clearly make us so much more productive!

Of course, as those folks who've struggled with Model-Glue: Unity (or Rails or any other framework) know only too well, it's not quite that simple!

So why do some people struggle when others find these frameworks so easy and so productive? The answer is blindlingly obvious, unfortunately, but it isn't an answer most people want to hear.

Sammy Larbi asks "is Rails easy?" and points to Venkat's blog entry "Can your cat code my Rails App?". The answer to both of these might seem obvious. The answer to the second question is clearly "no". The answer to the first question is, unfortunately, "it depends".

As Venkat says:

I asked why she thought developing with Ruby/Rails is so darn simple. She said she had seen a demo of a fully working app being created within minutes without much effort or code.

The videos are, of course, somewhat misleading because they show what someone can do once they already know the framework really well. It's the same reason that experienced OO developers find OO so liberating and productive: they already know OO really well!

Venkat compares C++ and Java, saying the latter is more productive with the following caveat: "I doubt anyone would say that Java makes an ignorant programmer more productive. You did have to take the time to learn the details of the language, the platform, and the API."

The point behind all this is that there really is no silver bullet. Using a framework doesn't automatically make you more productive from day one. You have to learn how to really use your tools and sometimes that learning process is non-trivial to the point of seeming endless (and being a lot of hard work!).

I post this because I got into a somewhat heated discussion at CFUNITED a few years back with someone who thought OO was dumb because they'd tried to use it and it made a mess of their application. I said that it takes time and effort to learn OO in order to be able to apply it properly. They got offended, thinking I was telling them they were too stupid to learn OO. I've repeatedly said: this stuff is hard. I started doing OO in January 1992 and I'm still learning. OO has mostly become second nature to me now but that doesn't preclude me from learning new techniques - often from people with less OO experience - that help make me more productive.

So don't think that Rails is going to turn everyone into super-productive programmers overnight - most people coming to Rails already have a fair bit of Java and OO experience so pick up the concepts easily and, once they've learned the Ruby and Rails specifics, they can be more productive than they were in Java.

It's the same principle that applies when you learn a new framework in ColdFusion. It may seem strange at first and may look like extra work but once you understand most of the specifics, you can be much more productive. Just be prepared for a learning curve.


June 13, 2007
Having just spent the last few days tinkering with AIR applications - including some training at the annual Adobe Summit - I'm pretty fired up about AIR!

You can build AIR applications easily with Flex using the beta of Flex Builder 3 but you can also build AIR applications with HTML.

You need the AIR SDK (again, from Adobe Labs) and a text editor (and access to the command line to run the adl and adt SDK programs to run and package AIR applications respectively).

Of course that might be a bit more work than you want to do. In which case, install Aptana - either standalone or as a plugin for Eclipse / Flex Builder - and then install the AIR plugin for Aptana. Now you simply create a new "Adobe AIR" project, fill out the application information wizard, select your JavaScript libraries (it assumes you are building an AJAX application) and off you go!


April 18, 2007
I'm doing some consulting right now that has me writing Java code. The more Java I write, the more I'm reminded of why I like ColdFusion so much but that's another story. The company I'm consulting for likes unit testing, which makes me very happy. They actually require that a unit test exists for every method in every class (and in every CFC - yes, they build stuff with ColdFusion as well).

Surprisingly, this is my first exposure to jUnit. Yeah, I know, I'm such a big fan of cfcUnit, how can I never have used jUnit? Anyway, I write my TestFoo.java class with its setUp() and tearDown() methods and start writing testMyMethod() methods. Then it occurs to me: how do I run this? I'm so used to the browser-based runner for cfcUnit that I'd never thought about the Java equivalent.

Out of curiosity, I right-clicked in the editor panel displaying the test case and there, in the Run As... submenu: JUnit Test. Wow! Really? Could it be that simple? Yup! Up pops a JUnit view in the bottom panel running my tests and showing a red failure bar and list of failed tests. Perfect!

Well, of course my tests failed - I just wrote the tests. Next I'll write the code.

As is so often the case, Eclipse continues to surprise me in pleasant ways! Now, where's the cfcUnit plugin?


March 27, 2007
Via my Adobe colleague, Andrew Shebanow, Hacknot has some choice words about dynamic programming languages. Read both blog entries and make up your own mind on this.

I love HackNot but it generally takes a very black and white view on things. Andrew, who is essentially taking over my old team, is a proponent of dynamic languages (as am I) and he feels that HackNot's analysis is thin, to say the least. I'm a big proponent of dynamic languages and have to agree with Andrew that HackNot's arguments are often specious in this particular scenario.

It still makes good reading tho' - just substitute "ColdFusion" for "Ruby"...


February 24, 2007
Not Invented Here and Reinventing The Wheel. We've all done it. We find something that does a perfectly good job but either it's written in a different language or written by someone else we don't know so we just decide to go ahead and write our own version. It plagues any coherent attempt at Open Source within the ColdFusion community - look at the number of half-baked calendars available (and don't get me started on the unit testing frameworks!).

Scott Hanselman has a wonderful post about trying to rewrite a perfectly good Boo library in C#. Classic NIH / RTW. And he paid for it - but at least he had the sense in the end to reuse the other person's wheel.


January 9, 2007
About once a year, I tend to mention Haskell on my blog. I like functional programming languages - that was my research topic for three years after I graduated from university. Haskell is a very powerful functional programming language that has a number of available implementations and, as I discovered this weekend, a very active community.

Last time I messed with Haskell, I chose the nhc98 compiler because it was easily available for the PowerPC Mac. When Haskell had cropped up in discussions with not one, but two ColdFusion developers this week, I figured I'd install it on my new Intel Mac. Except nhc98 is not available as a binary distribution for the Intel Mac. Easy, I thought, download the source and build it myself. The build failed. The notes suggest using the ulimit command to remove the file-size limitation on the shell. OK. The build still failed. The notes say if you can't solve it with ulimit, use another Haskell compiler to help bootstrap the build.

Try as I might, I couldn't find an existing Intel Mac binary of any Haskell compiler. But there's an IRC channel listed on the Haskell web site. #haskell on freenode.net. I figured that #coldfusion is so helpful that I might as well try the #haskell channel... There were nearly 300 people in there! And, guess what? They were very happy to help me for several hours. First, they pointed me at an Intel Mac build of ghc (the Glasgow Haskell Compiler) which, incidentally, was contributed by a member of the Haskell community (i.e., built from source and submitted back). I installed it and it worked just fine. So far so good.

Then I installed hmake and hi (hmake interactive) which are build and shell tools for using Haskell compilers. I ran into problems with a library dependency. Again, the IRC channel folks were very helpful. Following their instructions, I removed the (obsolete) dependency and successfully built and installed the two hmake tools. Yay!

Then I went back to nhc98, determined to build that from source. I ran into several more dependency problems. Back to the IRC channel. Similar advice (nhc98 is old and the dependencies aren't needed when using newer compilers to bootstrap it). I finally got it built but, unfortunately, every file it generated just crashed. By this point, the IRC folks were wondering why I was bothering since nhc98 has really reached a dead-end. They pointed out that ghc has an interactive tool (ghci) anyway. So I admitted defeat and starting playing with ghci...

Some of the tutorials on the web features code that didn't work. A quick check in with the IRC channel and I learn that Haskell 98 had a flat namespace for libraries but since then the standard library ("Prelude") has been reorganized into a hierarchy of packages. We discussed some of the slight differences between Haskell 98 (per the tutorials I was trying to follow) and "modern" Haskell and I kept on learning.

One of the interesting things about the channel is that members are constantly swapping code fragments and experimenting amongst themselves with ways to solve problems. Very collaborative!

So, once again, I'll suggest to the curious among you to check out Haskell.

I'd also ask you to think about the difference between the #coldfusion channel on DAL.net and the #haskell channel on freenode.net. #coldfusion has 20-30 members most of the time and occasionally gets as high as 50. For the most part it is banter about everyday life but folks will rally and focus if someone comes on asking a ColdFusion question. #haskell has 270-300 members and discussion is mostly about Haskell. We're all so very passionate about ColdFusion and we like helping newbies. Why are so few CFers on IRC compared to Haskell developers?


December 19, 2006
Michael Dinowitz has an interesting piece about monitors and productivity on Fusion Authority. I've never tried three monitors - my standard setup is two (one built-in and one external) with the external monitor being 19". Since Fusion Authority doesn't allow comments, feel free to leave comments here about your preferred monitor setup and what makes you productive.


Brian Rinaldi picked up on an opinion piece by Allen Riddle that asks if SOA (Service-Oriented Architecture) is killing OO in the enterprise. Brian draws a parallel between Allen's arguments about generic programming diluting OO programming and his own diversions into anemic domain models, often caused by having dumb beans and fat service objects.

[More]


November 7, 2006
In talking to my cat fancy friends, there appears to be a gaping need for high-quality, well-priced web developers who are happy to create static web sites for cat breeders. Most of the web developers who are offering services to non-web-savvy people seem to offer very poor HTML and a set of poor standard HTML templates.

Now, I know my readership is mostly about creating dynamic websites but I suspect many of you are also happy to create high-quality, standards-compliant static HTML websites at a reasonable price.

If that's within your business purview, I can hook you up with a community of cat breeders / exhibitors who would love a new website based on CSS and clean HTML for a reasonable price.

Email me via the contact page with links to your portfolio and I'll connect you with clients!


September 22, 2006
Allen Holub - a brilliant man with a tendency to controversial writing - has rattled some more windows with some of his thoughts about how we are all (ab)using XML these days. Whilst I understand his main points, he fails to acknowledge that by leveraging XML, we are taking advantage of a common language and lowering the bar for entry for many developers. We are also turning XML parsing into a commodity skill - rather than actually requiring "everyone" to learn how to write custom compilers and parsers. It's an interesting read. Thoughts?


August 20, 2006
Tom Ball (Sun Microsystems) asks the question "Is writing code a Career Limiting Move?" - there seems to be a strong sense in many teams that architects don't (shouldn't) code but it seems to go against agile thinking.

This post hits a nerve for me because as a senior software architect for most of the last decade, I've often found myself in situations where I've ended up quite distant from the code. And I don't like that much. I don't want to just write code but I do find writing code to be both very therapeutic as well as a good way to experiment with some of my ideas and evolve better practices.

I realized recently that, although I created the engineering team that rebuilt macromedia.com (now adobe.com) using ColdFusion and Flash, I hardly wrote any of the code on that site! The RSS feeds on LiveDocs are powered by code that is based on an initial prototype I built but that's about it, in terms of live code. I wrote quite a bit of back end infrastructure code for our ERP integration project (lots of XML processing and JMS messaging). That was a while ago.

My new team is smaller and is trying to be more agile in style so architects write code too. It's really good to roll up my sleeves and write code again - it's really helped me confirm some of my architectural ideas about what we're building (both good ideas and bad ideas!).

BTW, this lack of coding at work is what fuels my contributions to open source projects outside work, such as Fusebox 5!


June 14, 2006
Peter recently did a Breeze presentation to a couple of CFUGs and has posted the recording and the PDF of the slides (ZIP file download).

I haven't watched the preso yet but I'm using SVN / Trac day-in, day-out to manage Fusebox 5 so I wanted to get the word out...


May 24, 2006
Thanx to Dave Carabetta for this great discovery - he writes that Gentleware, makers of the excellent Poseidon for UML product, have teamed up with Synergy Learning to create an incredibly comprehensive online course entitled Introduction to Object-Oriented Modeling and UML. Dave has a lot of details on his blog as well as his thoughts on the course.


May 6, 2006
Is anyone out there using the Scrum process with their ColdFusion development? How is that working out for you? Please let me know what you think the pros and cons are in comments here.


February 28, 2006
I was just reading Kay Smoljak's rant about stupid comments (via a link on Todd Sharp's blog - where he posts a priceless comment found in Ray Camden's code!). Kay rails against people who put "obvious" comments in their code that don't add any value.

A few people point out that they sometimes sketch out code by writing pseudo-code in comments and then writing the real code, which can leave the code in the situation that Kay describes. I've done that too sometimes so I sympathize - but I generally replace a pseudo-code comment by real code, not write the code below the comment.

Anyway, it made me go back over some of my code to see what sort of comments I put in real code. The answer is: "very few". I was actually surprised at how sparse my commenting style is. The code is readable (in my opinion!) because it uses carefully named variables and methods so the code mostly reads like English phrases and sentences. I also generally keep each line of code pretty simple, breaking complex operations into multiple lines where possible.

We all have different styles, of course, but bear in mind that the main audience of your code is probably not going to be you in the future.

And here's an example of some real code I wrote with what I consider a good comment:

<!---
   some validation on formats:
      - should be at least 3 characters
      - should be at least two alphabetic
      - optionally followed by - and two or three alphabetic
      - optionally followed by _ and at least 3 alphabetic
--->
<cfif len(outputSalesOrg) gte 3 and
    REFind("^[A-Z]{2,}(-[A-Z]{2,3})?(_[A-Z]{3,})?$",outputSalesOrg) eq 1>

   <!--- it's probably valid --->
<cfelse>
   <cfset raiseException("INVALID","Unknown sales organization (#arguments.inputSalesOrg#) encountered",arguments.filename) />
</cfif>
The comment adds value because the code is compact and non-obvious (but this is a classic use of regex). I wrote the comment first and then wrote the code. However, since the code in this case is non-obvious, I left the comment in place.

Feel free to comment here or over on Kay's blog (to keep the thread in one place, if you want).


Basement.org's Rich Ziade has a nice observation about overthinking problems and the differences between short-term and long-term memory. The inspiration for his article? The U.S. Snowboarding Team listening to their iPods while competing at the Winter Olympics. They're blocking out distractions - and the noise of the short-term memory - to allow their long-term memory to drive their actions "automatically", drawing on their learned expertise.

Rich draws a parallel with designers and the designs they create - and how easy they are to learn. I want to draw a parallel with object-oriented design / programming. All the time you have to actively focus on it and think hard about the problems, it's difficult. Over time, you gain expertise and a comfort level - as the lessons learned move into long-term memory and things become more natural. In other words, you know you've reached a level of expertise with certain concepts when you find yourself applying them almost subsconciously, without thinking too much about it.

That doesn't make it any easier to learn OO, but it should give you a way to measure when you become effective at applying OO. Mind you, you might find it easier to learn if you try not to over-think how to design your solution - let it flow. If it's "wrong", you'll figure it out later and will have learned a practical lesson but more likely you'll just refactor your solution to be a better fit for your problem space over time.

And listening to an iPod while you program? Yeah, works for me...


February 15, 2006
In the last few weeks I've been receiving an increasing number of questions asking "Which framework should I use?". Sometimes there's quite a bit of background about the application to be built and / or the skillset of the developer(s) involved. Most often there is little or no background info. For example:
I just want to know your thoughts on this question... Which is the best Framework you think to adapt? (Fusebox or Mach II)
Even assuming they mean "adopt", it's certainly not a straightforward question. I'd recommend folks download my frameworks comparison presentation and take a look at the accompanying sample application code. This covers Fusebox, Mach II and Model-Glue and gives pros and cons for each framework as well as some broad recommendations based on your skillset and the type of application you want to build. The sample code has nine variants of a single application, showing various flavors of Fusebox, Mach II, Model-Glue, Tartan and ColdSpring in various combinations.

I'm currently running around CFUGs with a talk about "Objects & Persistence" that briefly covers four of the ORM frameworks that have appeared lately: Arf!, objectBreeze, Transfer and Reactor. I'll soon also be giving a talk about factories and covering ColdSpring. Both of those talks will be accompanied by more variants of more applications.

However, I get the impression that some of the people asking me this question want me to specifically recommend a framework or a combination of frameworks for them so they don't have to digest the presentation and code. The short answer is that there is no "One True Answer™".

Here's part of another email - which has a lot more background the question - but here's how the question was phrased:

Anyway, I'm looking for some guidance with frameworks. I am involved in a project that I know could benefit from using a framework. I just don't know which one would be best. The more I read, the more confused I get. I think I've narrowed it down to Fusebox or a Model-Glue / ColdSpring / Reactor set up. I really like the MVC concept, but am new to that as well, so I'm not sure if it would be easier to go with something that forces the implementation or trying to implement Fusebox in an MVC pattern.
This person has done their research and understands some of the tradeoffs involved which is great as far as I'm concerned. I sympathize with this part "The more I read, the more confused I get." - it's not a simple choice. They will get a long, detailed response - as soon as I find time. The other email shown above will get a short recommendation to read my presentation and look at the sample code.

The point of this (somewhat long) blog entry is that if you want me to offer advice on the choice of frameworks, I'm more than happy to do so - but the quality of the answer you get will be directly proportional to the amount of information you provide me with (and the amount of "homework" you show you've done).

And yes, I do have a personal preference - if there is no overwhelming reason to use a different specific framework combination. Just remember that what works for me might not necessarily work for you. What is my personal preference? Don't read too much into someone's personal preferences...


January 23, 2006
Scott Hanselman talks about optimizing an XSL transformation. He says the original XSLT is slow partly because it is written in a procedural style and he shows how making the XSLT more declarative produces dramatic speed ups as well as reducing the amount of memory used. At the core of this is the idea of algorithmic changes producing big optimizations. Think about that when you're agonizing over whether to use a list function or a string function - try to find algorithmic changes instead that dramatically affect performance!


January 20, 2006
Alexandru Costin thinks Ruby is the new Perl. I guess that explains why I took a dislike to Ruby without entirely knowing why. With hindsight, yes, it does remind me of Perl...


January 8, 2006
I've changed my mind. I no longer think ColdFusion needs interfaces. I've been advocating this feature addition for a few years but no more.

Why the change of heart? Well, with all the OO ColdFusion I've written, I must admit that I haven't really missed interfaces. At first I did, but then I started to use type="any" or type="WEB-INF.cftags.component" and that is actually more powerful. How can a "weaker" type be more powerful? Simply because you can pass any object that is able to respond to the necessary methods - those objects don't need to be part of a rigid single-inheritance tree!

I'm not the only person who thinks this way... Michael Smith just interviewed Hal Helms about his talk at CFUNITED 2006 and here's a little clip from that:

Michael Smith: So, you're going to argue that Adobe should add interfaces to ColdFusion?

Hal Helms: No! What good would that do us developers in the trenches who face these problems right now? Besides, that's exactly the wrong solution. The reason that C# and Java need interfaces is that they are statically typed -- that is, data types get determined prior to run time. But ColdFusion doesn't suffer from this restriction: it's dynamically typed. What we need is to embrace the fact that ColdFusion *is* dynamically typed. And we haven't even started to talk about mixins! There are all kinds of new possibilities!

Hal's talk is about "duck typing" which is only really possible in languages that have dynamic type systems (where a variable's type is determined at runtime based on its contents).

Smalltalk programmers are used to this, as are Ruby programmers and others. With all the enthusiasm around Ruby these days, ColdFusion programmers might do well to embrace some of Ruby's strengths which are also ColdFusion's strengths - including dynamic typing.


December 24, 2005
I saw this linked from Hal Helms' blog but wanted to give it both a broader airing and add some commentary. Meilir Page-Jones has written about the seven stages of expertise in software engineering (and bear hunting!). Innocent, exposed, apprentice, practitioner, journeyman, master, researcher. Go read the article for what each really means (he does bear hunting first, then software engineering).

Some years ago I was chatting with Scott Meyers (author of "Effective C++" etc) and he felt there are three broad classes of programmers: public, protected and private. Private programmers write operating systems and frameworks and other sorts of "black box" software. Sometimes they mentor teams of other programmers. Protected programmers understand APIs and frameworks and help drive projects (some protected programmers also write frameworks). Successful projects have at least one protected programmer mentoring the others. Public programmers build applications. They use frameworks and libraries but they don't usually understand exactly how those things work, just that they do work, and they rely on the protected (and private) programmers to help them design systems and get things working.

Going back to Meilir's seven stages, the private programmers are the masters and researchers; protected programmers are the journeymen and maybe some of the practitioners; public programmers are practitioners and apprentices (and occasionally some exposed programmers).

Meilir's J-curve is an important issue to consider - as folks advance from apprentice to practitioner they experience a drop in productivity as they take on all that new information and assimilate it. Meilir notes this can take between six and eighteen months and that moving on to the next stage (journeyman) can take another eighteen to thirty-six months. Don't underestimate the time this progression takes! I've encountered people who think they can just pick up a new technique (like OO) and be productive immediately - and who got quite angry with me when I suggested otherwise. As Meilir says, in general the shortest time from a seminar to full productivity with that technique is about two years.

Most of all I want you to read the article and take heart that learning new techniques really does take time. It doesn't mean you're stupid just because you don't get OO in a few weeks - you should expect proficiency to take a good while. My early OO efforts were pretty horrible, looking back... (hmm, looking back to 1992 when I started to learn OO!). Also remember that the seven stages apply to each individual technique or skill so there is always more to learn as new techniques appear and new skill opportunities are offered.


December 16, 2005
If you're a Windows developer, you should be reading Raymond Chen's blog (I'm not a Windows developer but I find this sort of nuts'n'bolts stuff fascinating anyway!).

He explains hyperthreading in a recent post as an answer to a question based on a misunderstanding about how HT works... but what's really interesting is the note in the comments about how certain applications run slower with HT enabled and then an explanation of why that may happen.


December 8, 2005
Some people were bitten by the addition of the isValid() function to ColdFusion MX 7 - they had implemented a method of that name on a CFC and the upgrade broke their code. My response was "Well, isValid() is a pretty dumb name for a method on an object!". Why? It's too generic. Valid for what?

A related point crops up in my "Enterprise Integration with ColdFusion" talk (from MAX) where I make the point that robust systems need to be able to save "invalid" data.

In other words, the validity of data depends on the context. For application robustness, you actually need to be able to accept - and store - any data, even if your business rules consider it "invalid". It's 'valid enough' to store it but not necessarily 'valid enough' to be used by the business logic.

I haven't really been able to articulate that point very well to some people. However, now I can point you at this excellent post by Martin Fowler on contextual validation.

What he said!


October 26, 2005
Well, I finally got around to installing Ruby on Rails this evening. Apparently it's very easy on some platforms but on Mac OS X it's kind of a pain. First off, OS X 10.4 (Tiger) ships with Ruby 1.8.2 which is what you need for Rails. However, as with several pre-installed OS X packages, it needs a bit of tweaking and some careful nudging...

Tony Arnold's Rolling with Ruby on Rails on Mac OS X Tiger is a great place to start. He offers an installer package that fixes the pre-installed Ruby and adds Rails etc. Caveat: if you have CFMX 7.0.1 installed, your httpd.conf file probably has some LoadModule directives after the AddModule directive block - move those LoadModule directives up to the end of the main LoadModule block before running the RoR installer!

Then he says to update your rubygems - make sure you switch to GCC 3.3 before doing this!

sudo gcc_select 3.3
sudo gem update
The MySQL gem will not compile correctly with the default GCC 4.0 version - you will not be able to connect to MySQL from RoR because the authentication will fail. That cost me an hour of frustration!

Then you can run through his test application example and it should just work. Pay particular attention to the chgrp and chmod commands he specifies and the directives in Apache to tie it all together.

At that point, you'll probably want to walk through the two part ONLamp Rolling with Ruby on Rails article: Part 1, Part 2.


September 2, 2005
This article on Fusion Authority about Amazon's "new" Shorts offering brought back memories... Back in '97 I started working with BroadVision which was an expensive, enterprise-class e-Commerce / portal system. One of its key features was support for microtransactions - cumulative pennies in payment for content or services. Nice to see that it's finally hit "mainstream" but don't be under any illusions that this is a new idea...


August 12, 2005
The Server Side has an unusually positive mention of Flash in this piece about WebORB from Midnight Coders that supports a variety of clients - including both AJAX and Flash - and a variety of server technologies including ColdFusion Components.


I've had a long love-hate relationship with PHP. I "couldn't afford" a ColdFusion hosted account for a long time (hey, I had a dynamic web site long before Macromedia acquired Allaire!) so I reluctantly used PHP. Brandon Harper picks up on reports that PHP may be past its peak with a massive drop in PHP usage in Europe, the Middle East and Asia. There's very little information about where the ex-PHP people are going (or even if the shift is caused simply by more and more new sites just using non-PHP technology) but it's an interesting data point all the same.


I've been meaning to blog this for a while... Java Boutique has a two page article about class design metrics and how they can help you evaluate your designs. It may seem very academic but these are tried and true techniques that have been around for well over a decade (I implemented these design metrics in a C++ source code analyzer in the early 90's and they weren't new then!). See how your ColdFusion code measures up!


August 2, 2005
Part of the fun, interesting and varied content on Fusion Authority - a link to a presentation (PDF, 670Kb) from the European ApacheCon this this entitled "Why I Hate the Apache Web Server".

Now, I love Apache but I'll accept that it has some, er, "quirks"... My favorite slide is the one that talks about the powerful mod_rewrite:

I probably don't need to say anything more than just "mod_rewrite". But I will.

"Voodoo" and "... flexibility of sendmail"

The docs practically scream "GO AWAY!"


July 20, 2005
Jared responds to Joe's post about the slump in Computer Science enrollment.

Joe thinks courses would get more intake if they offered a "more up to date" / "real world" set of languages for computer science. Jared sort of agrees, suggesting some sort of application development course.

I disagree with both of them (and most of the commenters on both blogs)! However, someone called Jeff commented on Joe's entry and I do agree with him:

I don't think the language of use is important; I think teaching the concepts should be the primary thing in any cirriculumn. Computer science concepts haven't changed much in the past 20 years. Languages have, but you can apply the concepts to any languages.
Exactly! The important stuff behind Comp Sci is about basic concepts and algorithms and a general understanding of how systems work. We're still running software on a Von Neumann architecture so all of this stuff still applies. You do need to learn about memory and pointers and data structures because those are the basics of programming.
Honestly, I doubt that the incoming students are going to be able to examine the curriculum and determine its usefulness (or not). I've known a lot of people who were thrown at a dozen languages in their college career, but never learned how to code.
Also agree! Computer science courses are not intended to churn out "programmers" - they're meant to turn out people who understand how to solve problems and how to reason about programming. Those are the building blocks of being a good programmer.
In college, I learned on Pascal (they switched to Java the year after I Graduated). Pascal was designed solely for the purpose of teaching programming concepts. I realize my experience is in the minority, but I wouldn't trade it for anything.
I too learned Pascal, not for the syntax or applicability of the language but for the concepts and algorithms. I learned a bunch of other languages in my spare time to tackle the real world stuff.

I think there are two problems here:

One is that people think they can somehow skip over the fundamentals and fast track to becoming really good programmers. I've met a few who are completely self-taught but they're very, very rare. Most of the really good programmers do have a computer science background (even if they went back and did night school to learn it).

The other problem is that people think academic institutions are supposed to create turn-key workers. Only experience can do that to be honest. Academia should help people hone their learning skills - it should not just teach a "trade".

Remember: unskilled jobs are easy to outsource - and that includes basic programming skills. Software design, architecture and problem solving are much harder to outsource. Academia is - and should be - about the higher level skills.


July 16, 2005
A lot of developers consider testing to be a bit of a necessary evil. They don't want to write test plans. They don't even want to write test cases. Some of them don't view QA as being in the same ballpark as development.

Designing and developing test harnesses and test case code can be every bit as challenging - and rewarding - as designing and developing the product itself. Some of the challenges include:

  • figuring out how to automate as much as possible, not only of the actual test case execution but also of the result verification and regression
  • figuring out how to create negative test cases - to test and verify error cases - that run automatically and accurately
  • figuring out the edge cases in the spec, the boundary conditions, the possible off-by-one errors
Developers tend to focus on positive execution paths and often don't worry about boundary conditions (yes, they should!).

So, as a developer, take some time to think about life on the other side of the looking glass. Think about test cases. Think about how you would plan all those test cases. Think about automating those tests.


June 21, 2005
My old boss, Derek Jones, has made available a 1,600 page e-book that analyzes the new C standard from an economic and cultural point of view as well as providing coding guidelines. You can read about the book and how it came to be on The Inquirer. You can also read Derek's new blog which will focus on coding guidelines.


May 17, 2005
Jehiah Czebotar has an interesting theory about why Google has created a web accelerator. It actually makes a lot of sense (although who knows what really inspired them to create the GWA proxy). Has anyone actually used GWA? What do you think?


May 12, 2005
Joel Spolsky has written a great article on Making Wrong Code Look Wrong. It's interesting for a number of points, not least of which is the true origin and meaning of Hungarian Notation. Simonyi, the creator of this naming convention, originally intended that names represent their semantics not their data types! I'm a very vocal opponent of what Hungarian Notation has become but the original vision has value. However, I still don't think that prefixes like 'rw', 'us', 'xl' actually convey anything particularly useful so I would advocate Good Naming(tm), by which I mean nice, descriptive English names for variables. In Joel's specific examples, instead of 'us' for unsafe string and 's' for safe string, I would probably use 'input' (since it represents user input) and 'encoded' (since it represents encoded data) or 'html' (since it is ready to render in HTML).
htmlName = encode(inputName);
That seems much more readable to me than:
sName = encode(usName);
Joel would have us rename encode() to htmlFromInput() which is... OK I guess.

Oh, and he has a knock at exceptions again. I'm in two minds about his comments there. He's right about how exceptions can made code paths hard to identify but I think the benefits of exception handling outweigh the additional burden of having to think about possible exception when you read code. Exceptions let you move error handling out of the 'main flow' of code - making the normal cases easier to read - and also helps you collect all your error handling in closely related chunks of code at appropriate tiers in your application. But it's certainly very easy to write bad exception code!


May 10, 2005
I've held off commenting on this for a while because of all the hysteria surrounding it. It's Windows-only so I haven't even looked at it - just watched all the (heated) discussions. And then I saw a pearl in my news reader this morning: Jennifer Larkin's admonishment to all the chicken littles who think Google have done something outrageous...


April 16, 2005
It was refreshing to see Ted Neward revisiting C++ and discovering the Boost libraries. It's a very impressive suite and I'm very pleased with how it's taken off. I was involved with Boost right at the beginning back when I was still involved with the C++ committe so it's nice to see this project going from strength to strength - my old colleague Beman Dawes is to be commended for his sterling work leading this effort!


Somewhat controversial, Grease Monkey is a Firefox extension that allows user-specified JavaScripts to be installed that mess with sites. There are some scripts that enhance Gmail by adding a delete button and a saved searches panel. These are immensely useful for Gmail, in my opinion. I have several searches that I perform over and over again - now I don't have to type them in manually, I can just create a custom search in the GM extension and then click on it whenever I need that search!


April 12, 2005
A very direct and provocative post from Ted Patrick on Avalon based on what Microsoft showed him at Flash In The Can. Certainly the few things I've seen that have been teasers for Avalon / Longhorn have been pretty eye candy so it'll be interesting to see what real, useful stuff appears and what the adoption curve is really like (when it all finally appears... whenever that is).


March 22, 2005
Nifty corners - how to create rounded corners without images, using only CSS and JavaScript.

I couldn't resist changing the color scheme when I aded some rounded corners. You can get the old colors back by adding ?style=red to the URL.


March 19, 2005
The last day of the conference was fairly intense with quite a bit of code-level stuff - the web service security talk was a real eye-opener!

In between the morning sessions, I bumped into Reg Charney, contributing editor for Linux Journal and an old friend from the C++ committee days. We caught up on life during the break and, after the event-driven architecture talk, we had a chance to continue our discussions over lunch. Not surprisingly, we talked about open source as well as life in the Bay Area (Reg and his wife are in the process of moving back to Toronto).

It's been a very interesting conference - lots of ideas floating around my head about new things to try in ColdFusion, things to review in the coding guidelines, new areas of technology to explore. With the sessions being 90 rather than 60 minutes, speakers get a chance to go into much more depth and cover the edge cases - that makes the talks more rewarding but sometimes harder to follow. But then good conferences should be a challenge!


March 18, 2005
I could subtitle this "How little I knew about WS-* security". I knew this was a rich topic but I had no real sense of how complex it can be. Michele did a stellar job of covering WS-Security, WS-SecurityPolicy, WS-Trust, WS-SecureConversation, WS-Federation, SAML and a number of other topics.

She talked about the goals of security (authentication - who are you? - confidentiality - encryption; integrity - signatures; reliability - preventing replay and DoS attacks). After that somewhat gentle introduction, she worked through an example (Hello World, of course) and added increasing levels of security to it, looking at the issues and benefits of each step, as well as explaining which a combination of all these techniques is actually required. Very impressive.

The XML behind all of these standards is monster scary stuff! Michele worked with VS.NET which I must grudgingly admit hides much of the complexity and auto-generates a lot of the machinery (although she still had to hand-edit a few bits of XML and insert some fairly verbose C# code into her examples as she went).

Increasing security generally adds some degree of bloat to the messages so there's a tradeoff: performance versus security. Key management becomes important pretty quickly as you work with more clients (to manage all their public keys). There are also hardware options for managing "nonce" (a per-message key with an expiry timestamp to prevent reply attacks etc).

A very comprehensive and impressive talk - much better than I expected!


Subtitled "Programming without a call stack", this was a bit of an odd talk. I expected more generality, I think, or... well, I don't know. But it was really about a specific set of Java classes Gregor had developed to solve some specific problems and, whilst it was interesting, it didn't really have much breadth.

He started out by explaining what a call stack provides: Continuation (return), Context (local vars) and Coordination (synchronized execution). This means one at a time sequential execution, in a determined order, on a single machine.

If you want concurrency (and scalability), you need to move away from the simple call stack model. He looked at threads but said they are hard to work with and fussy - lots of low-level housekeeping code. The Java 5 standard library adds a Future generic / template for simplified concurrency programming model. It has an isDone() and a get() method - isDone() tests whether the thread is finished, get() blocks until the result is available so it is a join operation. He showed more of the Java 5 library framework and it uses the Command and Executor patterns, just like Kevlin's generic C++ concurrency library. In fact, much of this section of Gregor's talk mirrored Kevlin's, despite the C++ / Java difference.

He noted that even with this easier programming model, it is still related to the call stack architecture: it has the same command and control scheme with a primary execution thread and explicit synchronizatio etc.

At this point he introduced his Event-Driven Architecture which, to be honest, looked a lot like JMS with publishers and subscribers and queues - except that it all operates locally under control of Java's threading model.

Because of his specific approach, that are several downsides: type safety is reduced (he relies on reflection to some extent, looping over the inheritance tree and using try/catch to find event matches) so testing is more important; dependencies are critical and can be hard to visualize.

One truism of systems like this is that loosely coupled systems are harder to diagnose and debug, no matter what techniques you use to implement them.

Overall it was an interesting little technique but it seemed rather fragile. However, between this and Kevlin's talks, I'm getting some good ideas for how to build an easy to use concurrency framework around CFMX 7's event gateway mechanism!


Subtitled "Enabling Iterative and Incremental Database Development", this talk focused on applying some of the agile software development techniques to databases.

Once again Scott mentioned that the data community missed out on a whole lot of software engineering - although we also need to recognize that they have a lot of value to add to projects with their database knowledge. The trick is to harness that by having developers learn some data techniques and having DBAs learn some development techniques and then working together closely in an agile manner.

He offered up some references: the Database Refactoring website; his "Agile Database Techniques" book; an essay on database refactoring.

He said that refactoring a database is harder than refactoring code because of coupling (many systems accessing the same database), lack of encapsulation (it's all 'just data'), lack of tools etc.

Classic commentL: "SQL is the root of all evil!" - meaning that having raw SQL embedded in your code is a sure way to prevent agile database development. Hide the SQL - use Data Access Objects at a minimum, use persistence frameworks if they are up to the job, use encapsulation. Don't let applications have raw access to the data.

Then he ran through a number of specific refactorings (replacing / renaming a column, merging columns, replacing one-to-many relationships with an associative table, introducing a surrogate key). In each case, the key elements are:

  • maintain the current and modified schema elements side-by-side for a while so applications can gradually cut over
  • add stored procedures to maintain integrity between the old and new schema elements
Once all your applications have been updated, you can drop the old columns, tables etc. This means that database refactoring takes time - months, years perhaps.

He touched on environments, saying developers need a database for experimenting with schema changes as well as a regular shared database. At Macromedia, we have a crash'n'burn instance for developers to play with as well as a shared 'dev' instance (and then we have several QA databases, an integration / load test database and finally production).

Another thing he emphasized was unit testing for databases - something almost no one in the audience was doing. A couple of references: DB Unit, UTPLSQL for Oracle.


So Google starts using XmlHttpRequest and someone coins a name for it (Asynchronous Javascript And Xml) and now everyone wants to see tutorials and "download" it...

It's not a product. It's just a cool name for an old technique.

Google turns up a bunch of tutorial stuff on using XmlHttpRequest which is the core of this.

Rob Rohan built Neuromancer a while back that is effectively an implementation of this.


Update: Rob's site URL changed (corrected above) and he has blogged some examples of how to use Neuromancer to do the "AJAX technique".


Kevlin's talk was fascinating - apparently it's normally a three hour tutorial so Kevlin had to work had to cut it down to ninety minutes.

Scott's talk was another information-packed session and, like Kevlin, he's a very engaging speaker.

Both talks gave me plenty of food for thought and I'll try to distil some of the recommendations down to apply them to ColdFusion.

Over lunch I got to chat with Kevlin some more - it was good to see him again as the last time I saw him was at my wedding (well, one of them).

Darin increased my enthusiasm for Eclipse and made me feel guilty for my lack of active involvement to date at the actual coding level of CFEclipse and Fusebox CFE!

I had planned to attend another Mike Rosen SOA talk but popped into the end of Dan Saks' C++ operator overloading talk and, since I haven't seen Dan to chat to for about six years, we ended spending the next two hours catching up on our lives and the state of C++ and Java. He mostly works in the embedded C++ arena these days and he's also the track coordinator for the SD conferences.

Then it was time for a "Fireside Chat with Joel Spolsky". If you don't read Joel on software then you're missing out on a lot of insight (and humor). One of the SD staff prompted him with questions and he talked about his time at Microsoft (adding VBA to Excel), his thoughts on interviews, software maturity, methodologies and magic - and a number of other topics. He's a very savvy IT veteran and funny to boot. I'm looking forward to his CFUNITED keynote!


March 17, 2005
Scott is a very blunt but entertaining presenter. His slides covered a lot of detail that I won't go into here but he made some glib but passionate comments before diving into technical details. He made several disparaging references to tools that automatically generate code from databases (or DDL / DML from code!) - be wary of "pressing the magic button". He also highlighted the divide between the way OO people think and the way database people think and joked that data thought leaders are still stuck in the 70's and missed the object stuff in the 90's - they're living in a fantasy land where you only think about data (and most of them don't do any real projects any more). At least I think he was joking, but maybe not.

He emphasized that OO model and data model are usually different (and should be!!). It's not a one-to-one mapping between database columns and object attributes. Not all columns appear in an object model and not all object attributes appear in a database. However, objects may need to maintain "shadow information" above and beyond their real data in order to be persistable - typically key information and update timestamps.

He highlighted a number of critical issues that object developers need to consider including: referential integrity - sets of related records require inserts / updates to occur in a specific order or they require transactions (or both!); sequencing is an issue (e.g., line items on an order typically have a sequence number in the database but may be represented by an ordered collection in memory - inserts and deletes are key operations).

When dealing with legacy data, consider adding views to simplify the legacy schema in order to make mappings easier. Also consider schema wrapper objects (data access layer mappings) so that you can refactor the legacy schema later without changing (most of) your application.

He also mentioned that lazy initialization of data is a good technique - only load the data you need for the current operation. This speaks to using data gateways for aggregate data and not creating arrays of objects for everything - just create an object when you need to drill down into that data.

At the end, someone asked him about Hibernate. He likes it, but it has a one-to-one mapping between tables and classes which is very restrictive (and not optimal in most cases). He noted that is being addressed in a future version tho'.

A very interesting talk with some challenging ideas.

Takeaway: don't slavishly write DAOs that correspond one-to-one to your database tables - think about your object model independently and do what's best for that while keeping an eye on the physical persistence model.


After weighing up this morning's options, I settled on Kevlin's talk about a generic programming approach to threading. It's been a while since I did C++ in anger but a lot of what he is proposing can actually translate to other languages, at least conceptually, even tho' the implementation relies heavily on both the Posix threading API and C++'s template mechanism.

He ran through some basic threading concepts and outlined what he calls four levels of thread safety:

  • threadbare - safe only in a single-threaded program: typically uses a lot of unencapsulated shared data / resources
  • exclusive - safe as long as threads are independent and the data / resource is guaranteed to be used by only one thread at a time
  • requested - explicit locking
  • transparent - safe regardless of threading

He emphasized that not all programs need to aspire to the fourth level of safety - sometimes 'requested' is the best you can do (and sometimes that's all you need!). A lot of code out there is only at the second (or even the first) level...

He made some broad recommendations that are worth noting:

  • If you have a container class, don't code locking strategies directly into it (it's restrictive and makes it harder to use / reuse).
  • Construction and execution should be separate. Never start running a thread / process in the constructor: construct it and then, when it is needed, execute it.
  • Inheritance vs. delegation - he showed a delegation model that used Command and Executor patterns and noted that this has looser coupling than the apparently simpler inheritance model but it also has more parts. Apparent simplicity doesn't always translate to maintainability or usability.
One term I hadn't heard before: monitor objects. These are objects that allow transparent multithreaded access by encapsulating locking internally. They are specifically designed to support multithreading and may well wrap simpler objects that would not otherwise support multithreaded access.

He started his talk looking at the basic C model for threading and noted that it was all based on functions and that a thread (function) returned a result which could be used by the parent process. Access to a result is often lost in higher abstractions, such as most C++ thread libraries. The thinking seems to be that you just need the thread to run, you don't really need it to return anything. However, we often do need the result and so we end up programming around the result-less model with complex joining / marshaling code.

The generic model he proposed uses functional objects (objects that look like functions, with operator() defined to perform execute / join operations). If you don't have operator overloading, you need an explicit execute() or call() method to simulate this - but it is a very powerful technique!

He deliberately decouples the logic of threads (functions) from the threading model itself so that you can unit test with simple mock objects in the absence of threading! Nice!

Finally he touched on locking, noting that it was an orthogonal subject and can (and usually should) be designed independently of your threading model. That was a very interesting insight.

Not sure how much of this might be applicable to ColdFusion but it's given me lots of ideas for experimenting with some framework code around the Asynchronous CFML Gateway that CFMX 7 provides!


March 16, 2005
After Mike Rosen's SOA talk and Josh Kerievsky's "smelly code", I skipped the lunchtime SOA keynote - partly because I'd had enough "SOA" for the day (Mike covered a lot of ground in an hour and a half!) but mostly because I was having a fascinating talk with Eric Evans of Domain Language.

I planned to attend Alan Shalloway's Pattern Oriented Design session but after the first five minutes it was clear this would be an introductory talk rather than anything in-depth. So I used the time to tour the exhibit hall. It was a bit of a trip down memory lane finding XVT still in business (cross-platform application development toolkit), as well as old competitors Parasoft and McCabe & Associates (competitors to Programming Research, where I used to work in the early 90's). I also spent some time chatting to the Recursion Software folks who bought up Voyager, JGL and the C++ ToolKit - products created by ObjectSpace, whose interview I walked out of in the 90's (after they'd flown me from London to Dallas!). Looked at SourceForge Enterprise Edition - I didn't even know they had a version other than their hosted version! IBM Rational had a booth but no one seemed to want to talk to me (not that I'm a Rational fan). Overall it seemed to be a bit of a poor showing in terms of exhibitors.

I originally planned to stay for Joel Spolsky's "fireside chat" but since that was over an hour away at that point and I'd exhausted the exhibits, I decided to head home for the day.


Funny how chasing a few links can turn up a whole series of gems...

More Bruce Eckel, this time talking about why weak typing doesn't have to mean you lose robustness. He compares Python to Java and uses automated test suites as an argument against the rigid static typing of Java (OK, that's an over-simplification but I hope you get my drift). It's an interesting position - and it follows on from the checked / unchecked exception discussion.

I always used to be a big fan of static typing and enhanced static checking - Dutch software studies in the 80's and 90's showed that static checking (source code analysis) was generally eight times more effective at finding bugs than dynamic checking (test suites). It was that sort of logic that probably led the developers of Java to favor checked exceptions.

Testing has moved on tho' and now, with approaches like Test-Driven Development, we have to some extent embraced the importance of testing and we've gotten better at automating it.

I'm still a little nervous about the shift from static checking to dynamic checking but on the other hand I love the productivity that weakly typed languages bring (Python, ColdFusion etc).

Just remember that when you call for stricter type checking in a language...


During Rebecca Wirfs-Brock's talk on Designing Reliable Collaborations (to be blogged shortly), she mentioned the issue of checked exceptions (in Java, you are required to declare all the exceptions you code throws but does not handle). She referred specifically to papers by Bruce Eckel and I found this discussion on his website that argues that checked exceptions - as found in Java and Java alone - are a failed experiment. It makes interesting reading, especially for someone familiar with both C++ and Java (C++ has only unchecked exceptions but the standards committee discussed enhancing the model to allow - but not enforce - optional compile-time warnings; Java has both unchecked and checked exceptions). More on exception handling will follow when I write up Rebecca's talk.
Update: following more links and Google results, I turned up this article by an old friend, Alan Griffiths that runs along the same lines as Bruce's article. Alan used to write for Overload, the C++ journal I edited for a few years (he may still do so?).


After blogging the Refactoring to Patterns stuff, I figured I'd attend Josh's session, entitled "Code Smells". A code smell is when you sense something is not really right and the code can be improved by refactoring. He defined "super" code as having the following 4 S's: "Safe, Succinct, Straightforward, Simple". Code smells when it violates one or more of those principles. He noted that sometimes comments can be considered deodorant for "smelly code" - better to refactor (and fix the problem) than simply add comments (to document the problem)!

He went through a number of different "smells" and listed several attributes that each of those smells have (e.g., bloated, exposed, duplicated). Smells have names like "Speculative Generality" (making code unnecessarily flexible or generic), "Inappropriate Intimacy" (where two classes are too tightly coupled), "Feature Envy" (where one class keeps calling methods on, and operating on the data of, another class) etc.

Some notable comments were:

  • In Test-Driven Development, the names of the tests should seed the documentation of the code - since good tests ought to reveal what the code does
  • A dumb data holder class can often be refactored - either to include behavior from elsewhere (making it a real class) or to move the data elsewhere (making it unnecessary)

He showed several code fragments and asked the audience to identify the "smells" for each so it was a very interactive (and entertaining) session. He mostly left the solutions - the refactorings - as an exercise for the audience. Very worthwhile!


Although I didn't attend Tuesday's workshops, it sounds like Josh Kerievsky's session was full of good advice about when and how to use patterns. I'll try to track down the Refactoring to Patterns book today (I'm sure there's at least one discounted book stall here at the expo).

Right now I'd better pay attention to Mike Rosen who is explaining SOA.


Update: check out Josh's refactoring website.