Search

Friday, July 9, 2010

Don't be so quick to blame ColdFusion


Not long ago my new boss and I were having a conversation and it came up that we might not be using ColdFusion much longer, but he’d get me trained on whatever I needed when they changed technologies.

Back story: The ColdFusion app that I’m maintaining now is an add-on to an asp.net application. It turns out the reason this add-on isn’t in .net is because the person they had available didn’t know or want to learn .net (I don’t blame him personally). On the home page of the .net app lives an iframe with a news scroller. The news is stored in a table and presented in a .cfm page. I’m sorry but I don’t see any reason why a single query and a few records can’t be displayed in .net, in a .net application. His aversion of .net was that strong.

When I asked why we were moving away from CF he said “Well, when we started this CF was the hottest thing, then not so much, now it is again, so who knows. CF also can’t handle the requirements. The system runs like shit!”

When I asked who said CF wasn’t the greatest thing anymore he said “the same guy that said it was great, the first developer.” I was pretty shocked. The same guy that didn’t want to learn enough .net to make a single page is now blaming CF for his lack of ability! Thanks to him, CF has a bad rap with my management and our customers!

The system did run like shit, fortunately for me one of my side projects is very similar to my day time job, making “charts and graphs 'n shit” as my boss puts it. I showed what I had done and how fast it works. I suggested it might not be CF, but the previous two developers. I asked him to give me the opportunity to fix the system before passing judgment on CF.

This week I put some proper error trapping in the system which logs the errors and a few other modifications. I saw a couple pages people were hitting often but were timing out. I made a couple changes to the query in question, removed the two queries nested inside the cfloop, removed # signs where they weren’t needed, removed some conditionals, replaced the several font tags with CSS, et cetera. The page loads in 1.3 seconds now. Using CSS also reduced the size of the .xls and html files by almost half (the xls files are html output with cfheader, I need to fix that too) so the page also downloads faster when 12,000 rows are returned (no, there’s no paging, customer requirement) from about 12 megs to 7.

Employers/managers: If your ColdFusion apps aren't running well, don't be so quick to pass judgement on ColdFusion. Look at your hardware, SQL, bandwidth and even your developers. If you're not a technical person, ask someone OUTSIDE of your team or higher a consultant to look at your situation.

I think I’ve saved ColdFusion’s reputation within my organization with these simple changes. My next hurdle is to save CF from our customers. Hopefully the proper error trapping and gradual fixing of the system will do this. Wish me luck!

6 comments:

  1. Nicely done. I know you mentioned fixing the HTML/Excel generation in the future. If you're lucky enough to be on CF9, cfspreadsheet makes this incredibly simple - like 1 line of code simple. You'll also get the benefit of much faster excel generation as well as greatly reduced file size.

    ReplyDelete
  2. I love ColdFusion as a language but just like every other language if the application is not written properly there are going to be performance issues. Also, I think a lot of ColdFusion developer use on queries inside loops as a crutch because they’re SQL skills are lacking.

    Well done!
    Paul Alkema
    http://paulalkema.com/

    ReplyDelete
  3. I've been asked in the past, "Isn't ColdFusion LEGACY?" We have an uphill battle here, and the only way to win is to win like you did in this situation.

    Thanks for sharing!

    ReplyDelete
  4. Could you explain on the error trapping techniques you use? Thanks!

    ReplyDelete
  5. @ Grant,
    It's pretty simple. Use onError in application.cfc to log the error, maybe send an email and redirect them to error.htm with contact information.

    ReplyDelete
  6. +1 to what Paul said. Any language can make bad applications. I've personally done it in C++, Java, C#, PHP, and ColdFusion. I'm very glad to hear other taking on the mission to inform the world that bad coding practices and procedures makes bad applications.

    ReplyDelete