Blog

22Jun
2010
Comparing ColdFusion To .NET

I don't really like ColdFusion .NET comparisons. A better comparison would be ColdFusion to ASP.NET, or ColdFusion + Java to .NET. But, having said that, ColdFusion developer Jose Diaz works for a company that migrated from ColdFusion to .NET (yep, I know, not overly smart). And Jose, having been exposed to the simplicity of ColdFusion before being forced to do things the hard way, created cfdot.net to compare code for common tasks.

Comments (12)



  • rg

    Sorry, after I got over my seizure, from the css styling on his site, I realize, it may be a good resource for me to use, when working with our programmers that use .NET services.

    #1Posted by rg | Jun 22, 2010, 10:06 AM
  • Marcus

    I think the author of the site should study up on his C# before posting overly verbose examples. Examples:

    - DateDiff. The .NET equivalent of the posted CF code would be: (date1 - date2).Days; The posted code is fundamentally different from the CF code.
    - sleep(). The CF code shows just the actual sleep() call, but the c# version shows thread creation, everything. Not exactly like-for-like.

    I've worked in both CF and .NET extensively. These sorts of comparisons are just misleading and aren't doing anything to give CF any more credibility. If people are going to do a 'comparison' it'd be worth studying up on the subject matter first.

    #2Posted by Marcus | Jun 22, 2010, 10:27 AM
  • Paul

    I agree with Marcus. If you're going to compare them, at least compare them fairly. Another example is dayOfWeek.

    Coldfusion:

    dayOfWeek("date")

    .NET:

    DateTime dt = new DateTime(2003, 5, 1);
    Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);

    A more fair comparison would be:

    dayOfWeek(date) == date.dayOfWeek

    #3Posted by Paul | Jun 22, 2010, 01:30 PM
  • David Hammond

    @Marcus, in fairness to the creator of the site, his stated goal is not to show how much more verbose .Net is than CF. He is just trying to create a repository of code that shows how different tasks may be done in ColdFusion and C#. Seems like a potentially valuable resource for someone that needs to migrate from one to the other, or who knows one language and is interested in learning more about the other. He also provides a submission form, which you could probably use to send him better samples.

    #4Posted by David Hammond | Jun 22, 2010, 01:38 PM
  • Henry

    can the layout be... wider?

    #5Posted by Henry | Jun 22, 2010, 01:56 PM
  • Shirak

    Compare is not good thing to do. Case study is what companies should focus on. I am working in hybrid environment, utilizing .Net, CF, JAVA, power builder. All languages mentioned do the same (Creating Application). The upper management always wanted to have both .Net and CF for simple reason, .Net is Microsoft product and would work perfectly with windows (+ resource availability); CF is adobe product, which works perfectly with other adobe products like Flex, pdf, image manipulation plus having underlying java libs.

    .Net, JAVA, FLEX, PDF, OFFICE, SHAREPOINT all are powerful libraries, and CF is the only language can put all libraries together. CF is the glue for all mentioned libs.
    So the question is why we are comparing?
    Why we are not making all work together?

    #6Posted by Shirak | Jun 22, 2010, 05:19 PM
  • ppshein

    Regarding above comments, comparing two technologies are odd. Honestly, CF is my so-called first web programming language ever. Oddly, I like .NET especially MVC but never try to compare CF and .NET. Because, we know a lot of advantages of using CF (even CF scope isn't wider than .NET) more than .NET for example: PDF, flashpaper and so on. .NET must be cool for others than CF because it's Microsoft products. Anyway, I love CF.

    #7Posted by ppshein | Jun 22, 2010, 10:08 PM
  • Marcus

    @David, fair point, but my issue is that each block of code is doing fundamentally different things; it's not like you could take the .NET code and produce exactly the same functionality verbatim.

    On the point of .NET being more verbose than CF, I don't necessarily agree. If you are up on all your C#, and using ASP.NET MVC, I'd say most code is similar length, and sometimes even smaller than the equivalent CF. Once you introduce Linq into the mix for working with collections, CF doesn't stand a chance.

    Example - return all items in a string array containing the letter 'a':
    CF:
    <cfset results = ArrayNew(1)>
    <cfloop from="1" to="#ArrayLen(myArray)#" index="i">
    <cfif myArray[i] CONTAINS "a">
    <cfset ArrayAppend(results, myArray[i])>
    </cfif>
    </cfloop>

    C#: var results = myArray.Where(x => x.Contains('a'));

    I tried to submit some fixes, but the submission form is broken...

    #8Posted by Marcus | Jun 23, 2010, 05:21 AM
  • Joel Stobart

    I think that the site was developed as a learning tool to help when he was needing to use .net, didn't know the .net function, but knew the coldfusion function call.

    I have a used a cheat sheet whenever I am transitioning between MySql, MSSql and Oracle. This is a similar kind of thing.

    I guess other people do too. Also if things could be done better, it might be good to suggest improvements

    #9Posted by Joel Stobart | Jun 23, 2010, 07:02 AM
  • Nathan Stanford

    Remember when you complain he took the time to do the work. If you have something better then email it to him.

    I think the site is great. There is always better ways. This is not a site from my understanding trying to start a fight
    as to which is better ColdFusion or DotNet. (we know CF is better...LOL) This is for helping beginners in C# and DotNet.
    If you are a C# expert then you may not need this site.

    I say thanks for your time and good job.

    We all have our likes and dislikes about look and feel so just be happy he does not look at your site and decide if it looks
    good or not. :)

    Big Nate Sr - The CFNut & DotNet/SharePoint Guy.

  • MT

    Good job with the site. Simple and straightforward. I think comparisons like this are good and bad. The good is that you get to see how to accomplish the same thing in different languages. The bad thing is that there is always more than one way to do it and some more efficient than others.

    This discussion seems to be about which language is better (and everyone is entitled to their opinion), but there has been no mention regarding speed of development. I work in a shop where .NET and ColdFusion development coexists and I see the different ways applications are built and deployed. The .NET developers work more hours and have a much more rigorous build/deployment processes; the ColdFusion guys work on a larger number of projects and have the advantage of working on more diversified solutions, all while having a relatively normal work week.

    Keep in mind, both technologies have their pros and cons. You can do things in .NET that are faster (and sometimes not even possible in ColdFusion) and vice versa. I've worked on projects where both technologies were used and find that ColdFusion is much easier to work with. I don't think that one is better than the other; I think it's all about your individual preference, the direction of your company and what makes your development efforts successful .

    #11Posted by MT | Jun 24, 2010, 12:52 PM
  • n

    Having experienced this first hand (with the originator ;-) the comparison between CF and .NET will and always exist - just like Apple v PC, PHP v Perl yada yada yada.

    The premise / MO of this site was to show what you can do with less code over .NET - it was a "fluff your feathers" over a technology which was being eradicated due to technical ignorance. It performs a function of showing you what you can do in each language and hey if it swings more people to the CF camp then great! ;-) It's an educational resource more than a fight picker but I can see why it may appear to be the latter in some eyes.

    You will always get fanbois and indeed if you had to choose, a smart person would choose the best tool for the job - be it CF/NET/PHP/Perl etc.

    However.....sadly, the fact is - outside of Adobe and current ColdFusion users - CF has an horrible reputation (one I fought against everyday) - in fact it was laughed at in some cases by people who deem themselves as "real programmers" - it's not taken seriously. The situation is not helped that Adobe charge a huge sum for the software - it isn't cheap at $7,5K where .NET or other "programming" tools are free (this may seem like a disgruntled cost/consumer issue but if you have been in meetings when you need to justify an upgrade to the latest software for the next business critical feature and you table it will cost circa 20K to upgrade a farm - it's laughable) - it's hard to win an argument of "I need X licenses for CF at $X" when an org would be better suited to hiring a person at that cost and you may gain more as a business.

    Just my $0.02 from experiencing things in the battlefield ;-)

    #12Posted by n | Jun 29, 2010, 11:45 AM