ColdFusion vs Flash (Part III)

I haven’t had time to focus on this for the last few days because I’ve been working on, and on finishing up the ColdFusion portion of the Community Resource Directory application. The CF side is completely done now, which includes both the CF server-side code (the web services and everything “below” the web services), and the client-side code (that which interacts with the web services, and everything “above” it).

The architecture is such that the ColdFusion front-end can be installed on another server, and still work seamlessly with the rest of the application through web services. I wrote it that way because I wanted to be able to install the front-end of the application on multiple servers throughout the company, not so much for performance reasons (although this architecture does allow for a form of scalability), but for convenience.While I was developing the CF front-end of the application, I was very impressed by how well it performed considering the fact that it was using web services and several layers of components. In fact, there was no perceptible delay beyond what you would expect from any web application (time to make the request, render the results in the browser, etc). Once I installed it on an internal production server, however, and imported over 200 records from an Excel spreadsheet, I started getting the type of performance I had been expecting. The reason it was so fast during development is that I was only sending a few test records over the wire at any given time.How slow is slow? Well, using only components to retrieve a query object with 206 rows takes between 61 and 110 milliseconds (pretty darn fast, I think). Retrieving an identical query object through web services takes anywhere from 877 milliseconds to 1400 (pretty darn not fast, I would say). Considering that using web services can be up to about 20 times slower, one might jump to the conclusion that this was not the smartest way to design my application. Allow me to explain.Web services are amazingly convenient and useful. One of the reason they are so convenient and useful is that they work across so many different technologies. The reason they work across so many different technologies is because they are so abstract, and typically with abstraction comes overhead. One could say, therefore, that with convenience often comes overhead. To a certain extent, that’s ok. For instance, people don’t write web applications in C or assembly because although they might execute faster on the server, they would take too long to develop and maintain. Developers are generally willing to give up speed for convenience in most circumstance, at least up to a certain threshold, and although using web services for the application makes it around 20 times slower than if I were just using local components, it’s worth the convenience of my application being more easily distributed.The absolute best way to write an application like this would be to make it configurable enough that you could have it use either web services or local components. I should have thought of that from the beginning. Oops. Oh, well. It won’t be hard to re-factor. Before I do that, though, the next step is to write the Flash front-end and compare developing the front end with CFML, HTML, JavaScript and CSS to building it in Flash. My Flash skills are a little rusty, so there will be a little learning curve, but I should have something to report back soon after MAX.