Wednesday, September 2, 2009

ColdFusion vs. PHP

A commenter to a previous post asked, "Why for example, would someone chose CF over a traditional LAMP setup?" (I looked up LAMP to find that it means Linux, Apache, MySQL, PHP.)

I may not be a very good person to answer this question, but I will give it my best shot, and I will ask some who are more versed to comment.

I believe that many people use Linux, Apache, and MySQL with ColdFusion (it's been camelCase rather than two words since version 3 or 4), so the main issue is PHP vs. CF. (My particular setup is Windows, IIS, Oracle, and CF, and I don't know the web server part at all.)

I have used PHP a bit but only for very simple stuff, almost like a server side Javascript. I liked the way it seemed very simple to make it modular in the procedural style I had learned in school.

When I learned CF, I learned it from someone who doesn't really "do modular." I mostly learned basic CRUD, done poorly. I took over and maintained lots of bad code and am only now finding the time to learn how to do things well. The thing I've found most difficult about CF is learning its modularity. Much of that problem has to do with my department's slowness at keeping up with updates and my slowness at learning the new things that each update had. After attending CFUnited, I found out that there are many ways to be modular in CF (including OO, which I didn't learn in school), and I just needed to learn them.

The things that I know are great in CF (much easier than in PHP) include connecting to and querying the database, writing out to Excel or Word, and sending email. Since so much of the work I do is database related, I am convinced that CF is the better tool for lots of database work.

I would certainly not hesitate to use PHP again, but would probably avoid it if possible for large database projects.

Thanks, That Web Guy, for your question.

22 comments:

  1. So I think there are two major things you need to look at when comparing ColdFusion and PHP.

    1. ColdFusion bundles a lot of functionalty under the hood: Direction integration with Java, .NET; built in manipulation of Exchange, SharePoint, Office, PDF's, images, ldap, mail, databases.
    2. Those integrated services can be accessed with very little code. You can pass data from .Net to Java in 2 lines of code.

    Those integrated services, combined with conciseness of code result in a huge productivity boost for ColdFusion developers. PHP has it's pluses as well, but I'm biased for ColdFusion.

    ReplyDelete
  2. Writing HTML in cf code is completely natural but a giant pain in the butt with php. Oh and cfdump. And also the application.cfc.

    ReplyDelete
  3. If you think libraries are great in PHP... check out some of the great libraries at riaforge.com and you will find things like DataMgr that will take it even farther! ColdFusion is great because of what they put in... and because it makes it easier for us to extend. (I like chickens and eggs personally... don't care if one came first when it's time to program.)

    ReplyDelete
  4. I'm getting asked these questions every few weeks. So I've decided to write down my personal intention. Although it's in german, you'll might get my points. You can find the Why we use ColdFusion on my blog.
    The conclusion of my developers perspective: why should one use another technologie when his prefered one fits all his needs (and the customers needs too)?

    ReplyDelete
  5. Most of what Terry points out are not yet available but should be in the next release - ColdFusion 9.

    ReplyDelete
  6. Actually Peter, only the Sharepoint and Office Integration aren't natively available to ColdFusion users today (unless you're running the CF9 Beta).

    ReplyDelete
  7. I've built web apps in .Net, PHP and ColdFusion. I wrote a post recently which is aimed at clients who want to know why we prefer to use ColdFusion to develop websites. If you're interested you can read it here:
    http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/why-use-coldfusion--230

    ReplyDelete
  8. My big thing about ColdFusion is the cleanliness of the code you can write. PHP tends to get a bit messy once you get deeper into your project. That's about it really. I have no beef with either languages and use them both on a regular basis.

    ReplyDelete
  9. @ Johnathan PHP dbug. They copied CFDump because it is so useful and a key benefit to CF. Even has the same colors.

    @Andy Allen There are HSSF {apache} objects built into CF7 that work very well for making Excel Spreadsheets. OLE was available as far back as CF5, not sure how useful that is/was or how much use it got. Sharepoint ... hmmm. ok on that, but yuck.

    ReplyDelete
  10. I am one of those Linux + Apache + MySQL + ColdFusion people. I have been a Linux fan for years (on the server side, not as much for desktops). In fact, I am typically anti-Microsoft. I got into ColdFusion because of a previous job and have used it ever since. At my first CFUnited a few years ago, I was very surprised to find that most CF people use Windows/IIS, considering that they are not using ASP. But to each his own.

    ReplyDelete
  11. LAMP stands for Linux+Apache+MySQL+PHP, and I suppose the appeal on LAMP is simply because it's FREE... forget OPEN, but emphasis on FREE. But currently, with Free Railo or OpenBD as application server, MS-SQLExpress wich is also free as DB, and let's face it, we all have a windows machine (with IIS built in), it seems more cost effective to build a web application using these products. It's easier to integrate into most networks and infraestructures, have extensibility into Office, Exchange, Sharepoint, etc., you save lots of time in configuring your environment. IT just seems more Cost Effective to use Windows + Iis + SQLExpress + ColdFusion (or free Railo o OpenBD)... I'm not sure I like the acronym, but I will say I like WISC better than LAMP

    ReplyDelete
  12. I am trying to promote the use of the terminology CLAM stack (ColdFusion, Linux, Apache, MySQL) but so far not much traction.

    ReplyDelete
  13. Okay, I swear blogspot hates for me to comment on my own posts. Maybe the problem is only in Firefox--guess I need to post often enough to remember that. I typed out a nice response and it has gone into the ether.

    Terry, you stated a bit more fully what I am saying about db connection, output to files, and email.

    SOSensible, I need to look more at riaforge since I've been learning so much.

    Mischa, I was able to follow the Google translation and I think others familiar with CF would be too. PHP developers might need to brush up on their German since they're not likely to be familiar with CF.

    John, I forgot your post. Thanks for posting it.

    Anon (at 3:04p), WISC is a better acronym than WIO(racle)C :-)

    ReplyDelete
  14. I use ColdFusion because it's a dead language and I like that I have the ability to do so much, so fast, with a language I resurected from the dead (again and again).

    Of course, I'm joking.

    ReplyDelete
  15. Today, once again, FaceBook is reeling but not rocking. I have been getting stale content, page load time is diabolical so why in heavens name doesn't PHP get a bad name for such things?

    ReplyDelete
  16. Depending on what language you're already familiar with will probably answer the coldfusion vs php question. Obviously there's plenty of hosting options for php, and not as much for coldfusion. I started learning drupal because of hosting support and server availability... but now I know I can host CFML via railo (getrailo.org)... and theres a pretty nice cms Mura.

    Personally I think the syntax of CFML is ugly, but holy crap you can get stuff done! Having the java foundation is a plus for me. I love the java syntax and the language so I know coldfusion can inherit a lot of powerful functionality.

    What you can't do in ColdFusion you can move lower and use java.

    Its a powerful stack of technology, ColdFusion is just a servlet adding a ton of awesome functionality to the J2EE stack (as I interpret)

    ReplyDelete
  17. In the not too distant future I plan on getting a rackspace cloud server. thinks its about $11 per month. install the linux flavor of my choice, configure mysql apache/tomcat and railo and host a few cfml sites. I'm not sandboxed. I can add as many sites as I think the virtual machine can handle

    ReplyDelete
  18. "ColdFusion queries are 'beautiful'" Antonio Lupetti in http://woork.blogspot.com/2007/11/coldfusion-vs-php-part-1.html

    'woork' says it nicely and give some examples. Some point out in the comments that you would abstract out some of the code in the PHP so that you only wrote it once. True, but when you're first learning, you still have all those steps where you can screw something up. cfquery is *really* easy to learn.

    ReplyDelete
  19. Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.


    logo design company india

    ReplyDelete
  20. ColdFusion is great if you are a ColdFusion programmer. From an organizational perspective, after you quit/die/whatever, it isn't so good. Finding an experienced pHp/ASP dev to replace you is so much easier.
    With ColdFusion, your organization it committing to a proprietary system that's not Microsoft. I don't advocate the Microsoft solution, but at least they have a monopoly to ensure your code isn't worthless!

    ReplyDelete
  21. I am being forced to learn PHP for my work, as the government organization I work for is switching to the LAMP stack and getting away from CF to my dismay. I've been coding in Unix and CF for some time.

    I am of two minds about this though as I start my learning process. On the one hand diversification is good, and I am trying to stay positive on this switch, but so far I have not seen a single thing other than initial setup costs in PHP's favor. It is an ugly language that takes easily half again as long to code something as it does in CF. The money they think they are saving by not paying up front for CF I have a feeling they will be giving back in longer development times, and in some cases for a much lesser product since some things CF does so easily now (PDF, image manipluation, etc) PHP does not nearly as good, if at all as far as I can tell so far.

    I sure hope my experience improves, and for my personal and side jobs I will certainly be sticking with CF.

    ReplyDelete
  22. Great post and very well written, that will really help you to learn Web Design, web development and SEO Strategies to help businesses web design company . You can find out many useful information about web design, seo and his work by visiting his blog and I Just wanna say thanks you for the information you have shared. Web Design Company India

    ReplyDelete