Thursday, June 02, 2005

Why are so many down on ColdFusion?

I've been reading Mark Kruger's post about Coldfusion and its undeserved Bad Rap - is it I?. While it's a great post, about why it's so easy to do ColdFusion wrong, we're still focusing on the wrong things.

The problem with coldfusion code, is not coldfusion's fault, it's the coders fault.

So let's stop putting the blame on the language, and more on the coders.

I'm not saying coldfusion is the language to solve every problem, but it has it's strengths and weaknesses like any other language.

But for 90% of most web applications, Coldfusion is one of the top 2 solutions for it.

Let's explain why ColdFusion is one of the top 2, and let's be realistic.

1. ColdFusion coders are much cheaper and faster than java/main frame coders, simply because it's a markup language, easy to use, but hard to master.

2. Now that ColdFusion is now a java application it is much more stable, than it ever was.

What was the slogan of ColdFusion when we just got started?

Rapid Application Development

So that means speedy development of applications, if we code it right.

So let's stop downplaying ColdFusion because it's not OO-enough, java enough, framework friendly enough, that is 1% of what ColdFusion was created for.

Rapid Development of Applications, using good and reasonable standards of coding. If a framework helps improve ease of coding, while not interfering with scalability and performance, than by all means use it.

Think about it from a client's end. Does it really matter if you use the latest standard? Only if it's a good standard that delivers scalible code.

I know I really repeat that point, because I don't feel like many people really get that. And instead of worrying about quality code delivering for high performance, they worry about the latest framework, oo/mvc, cfcs.

Let's talk about CFC's. First of all, I am glad they are a part of the ColdFusion language set, but they were only specificially designed for webservice usage, and instead we get tons of people using them for regular applications, when they're not an improvement in performance.

I know it's a cool way of coding applications, but SO WHAT?

What's more important? The coolness of the coding style, or delivering applications that don't crash the server? Or causes endless errors?

If CFC's are proven to be of at least equal performance as cfincludes, then I'll be happy to use them, until them, they are a waste of time and energy.

I remember, when I was working for a previous job, and an outsourced company was hired to create a checkout process, and instead of using normal coding methodology, they did it as a CFC.

Are they BLEEPING Serious? CFC's are specifically just for web service usage, and instead you wasted weeks and money which I'd eventually have to re-do, because it wasn't scalible.

And don't give me this crap, oh you haven't worked on an enterprise application, of course I have. Maybe it's not in huge teams, but I've been working with top national companie's, being the main coder, having to clean up everyone else's code.

You can call it my nickname, Mr. Clean. I am the one who has to clean up everyone else's code.

And I am sick and tired of everyone else caring more about using the latest gui, methodology or standard, than producing scalible, quality code.

I've been forced to clean up fusebox code too. Because we needed an application, like 100% of ours, had to be Search Engine Friendly, so we had to waste more time and money re-doing it, into a regular application.

I understand the need for a framework and methodology, and fusebox has brought a lot of good ideas, but really when you look at the app from a customer's point of view, it's really not user friendly.

And it's not really coder friendly.

Unless you are that group of people who are fuseboxers and only work on 1 part of an application.

I know i am of the rare ones, that work on a full application, and that has a lot of benefits.

I get a much better idea of what everything is supposed to do, I am a much more complete and thorough coder, than if i were a fusebox coder.

I do forms, html, tables, css, javascript, dhtml, sql statements, I do it all.

But I am tired of being angry, I just want more people to get a grasp of common sense.

Of course, since I am not flouting what the popular bloggers say, so more people will hate me, but that's my due I guess for being different.

Be well.

Long live ColdFusion!

18 comments:

  1. I too think some people forget the RAD aspect of CF, and I think mainly its because of its ties with J2EE (undeniably anti-RAD). You had some good points, until you got to the part on bashing CFCs.

    Why do your posts often turn into OO-bashing?

    CFCs being for web services only? Pfft... please tell me you're kidding...

    Here's a snippet from an app I'm currently working on:

    <!--- Fetch the syndicate --->
    <cfset syndicate = createObject("component","app.model.syndicate").find_by_id(url.id) />

    Ok so we've fetched it from the database. So lets check security.

    <!--- Security check --->
    <cfif not request.user.is_member_of_syndicate(syndicate)>
        <cfthrow type="Security" message="Syndicate not found" />
    </cfif>

    Hrmm pretty simple. 2 lines of code and a cfif so far.

    Now lets fetch some more complex data. How about we print all the names of the syndicates that this user belongs to:

    <cfset users_syndicates = request.user.syndicates() />

    <cfloop from="0" to="#len(users_syndicates)#" index="o">
        <p>#users_syndicates[i].getName()#</p>
    </cfif>

    Another 1 line of code, and a cfloop.

    And this aint pseudo code. No cfquery's, table joins, custom includes, etc etc. Just the required logic for that single cfm page.

    Doesn't look like an unmaintainable mess to me, and certainly has zip to do with web services.

    ReplyDelete
  2. patrick_at_redsquare.com12:08 AM

    while i agree that producing good, maintainable code is more important that using whatever technology is the flavour of the month. I disagree with your comments about CFC's

    They definantly are not specifically for web services. They are also there to provide a way of producing clean structured code by the use of Cffunction calls.

    cfinclude is good. but the fact that all your variables are in the one scope can cause all kinds of headaches, and foces the developer of the cfinclude file to know what the developer of the page thats using the cfinclude has done. ie. you dont get black box re-use.

    cfc's force you to code to the contract of cffunction arguments and return values. you know what data you need to provide and you know what data you are getting back. This promotes good coding because there is a clear path that data is following.

    while you could argue that custom tags also do this. the fact taht you can do dodgy things like set caller scope prevents this clean break from one piece of functionality to another.

    so in short, cfc's = good. Using cfc's to do all kinds of java-like OO stuff...good, but only for the more advanced developer.

    ReplyDelete
  3. Anonymous12:24 AM

    I see you're continuing to spout the same old nonsense about CFCs being only for web services... you are so clueless!

    ReplyDelete
  4. I like playing with cfc's and they are a means of re-usable code. But that is a bit slower than using regular code or cfincludes.

    I am sure they are fun to play with. But why use them for anything then what they were meant for, Web services?

    Now if someone had proof they were just as fast as coding with cfincludes, then i'd use them myself.

    The key is at least in the old days, cfinclude was fastest and cfmodules, custom tags always last in performance.

    And performance is most important.

    ReplyDelete
  5. Anonymous3:22 AM

    Craig, can you show us how you inherit from a cfinclude, or how you encapsulate data in your cfinclude, or even hide the functions in a cfinclude.

    You made a fool of yourself with this posting. It shows you desperately trying to convince others you are a very good developer, but instead your posting reveals you as an amateur not knowing the difference between OO and procedural coding.

    ReplyDelete
  6. But who cares what i inherit from a cfinclude?

    That's not relevent.

    What's relevent is what functionality i have to deliver with the application that needs to be created.

    Why does encapsulation matter at all?

    Does it deliver faster loading code? Does it make code more scalible?

    I am really sorry, but what does any of OO have to do with delivering better performing applications?

    For example when i work with Javascript which has a oo slant, i can still see the logic of getting from point A to B.

    If a framework or a way of coding improves performance then i'm all for it. If instead wastes time, to see if you can talk about programming in a certain mind set, then it has no value to me.

    Now if you have to work with cf into java for some fancy graphics, or any other area where java is strongest, then of course you will use best code possible.

    If CFC's deliver better performance then cfincludes, then i'd switch to them immediately.

    If they don't then it's a waste of time, unless i need it for a web service.

    If OO, delivers easier to understand, better performing code, then I'll use it.

    But the fact of the matter, while OO is the hot trend, it's very hard to understand, and that is a bad factor for any framework.

    Code should be easy to understand, to make it more easy to change and to improve.

    I'm not putting myself as some elite coder, I am just a guy, who see's things apparently differently than others do.

    It's really sad, when people have to insult me, instead of just having an honest discussion, on how to deliver better code.

    That's all I care about.

    For me Performance of the application is number one, second, is ease of reading, fixing, changing improving the code.

    ReplyDelete
  7. Anonymous4:56 AM

    I don't get posts like these.

    "What's more important? The coolness of the coding style, or delivering applications that don't crash the server? Or causes endless errors?"

    This is a leading question, If the developer can code well (or cool as you put it), not crash the server and not have have endless errors, then that is a skilled developer. They are not mutually exclusive.

    "I've been forced to clean up fusebox code too. Because we needed an application, like 100% of ours, had to be Search Engine Friendly, so we had to waste more time and money re-doing it, into a regular application."

    SES URLs can be created with fusebox applications, this search http://www.google.com/search?q=fusebox+ses&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official gave me this solution http://developer.fusium.com/tools/ses.cfm

    "And instead of worrying about quality code delivering for high performance, they worry about the latest framework, oo/mvc, cfcs."

    I suspect that it is a combination of both, the worry about latest techniques and language features is part of a drive to be better at delivering solutions to their clients.

    "Let's talk about CFC's. First of all, I am glad they are a part of the ColdFusion language set, but they were only specificially designed for webservice usage, and instead we get tons of people using them for regular applications, when they're not an improvement in performance."

    This is a complete fallacy. CFCs, as several posters have pointed out, are much much more than web services implementations. You really should take the time to understand how they work.

    "Are they BLEEPING Serious? CFC's are specifically just for web service usage, and instead you wasted weeks and money which I'd eventually have to re-do, because it wasn't scalible."

    So you re-code CFCs into includes and consider that improving it based on that alone?

    "And I am sick and tired of everyone else caring more about using the latest gui, methodology or standard, than producing scalible, quality code."

    Methodologies and standards, and sometimes even IDE (Is that what you really meant?) help us be more productive producing said scalable, quality code.

    "And it's not really coder friendly."

    I think that's really a matter of opinion, and based on what you've written, it's not friendly to you. I really suggest you spend some time learning CFCs, about frameworks and new techniques with an open mind. I really believe, if you could, you would realize that deepening your skill set does your client a great service as you will be able to more effectively deliver solutions that are easy to maintain for both yourself and others.

    "But I am tired of being angry, I just want more people to get a grasp of common sense."

    Don't be angry, get more educated about what people are doing and why they are doing it.

    ReplyDelete
  8. Anonymous6:55 AM

    I agree with some of your comments -particularly how people undersell the RAD aspect of CF. I'd have to disagree regarding CFCs (as many here have). CFC's help us avoid cowboy code in a team environment. We actually do need encapsulation and inheritance to help with division of labor issues when coding a large application. As for performance, if written correctly they perform much better than custom tags. Perhaps not better than CF includes - but with a CFInclude you have very linear code. It's likely that a developer will need to look at and perhaps even workaround or modify the code to make use of it as a CFINCLUDE.

    The other thing that turns me on about CFC's is that I am not tied to a display medium. With a set of CFCs I can access the same underlying data and event layer from a browser, flash, pda, gateway.... whatever - or, as you have indicated as a webservice for cross-platform deployment (not to be undersold - it's a huge feature).

    Thanks for the link back on my blog by the way. -Mark Kruger

    ReplyDelete
  9. Doesn't Macromedia post their own internal "Mach-ii Development Guide"...wouldn't the guys developing at MM have a clue what CFCs were intended for? Or, perhaps, you understand their intentions better than they do.

    ReplyDelete
  10. Please understand that speed and scalability (not 'scalibility') are two different beasts.

    Scalability, in terms of web applications, usually refers to the ability to add more application servers to deal with increased load, without much modification to the software.

    Luckily for you, using Coldfusion gives you access to the scalability features of J2EE, as well as extras like ClusterCats etc.

    You should definitely not think that the use of CFCs affects the scalability of your Coldfusion application.

    Macromedia, the creators of Coldfusion MX, recommend using CFCs to encapsulate your cfquery calls, and Dreamweaver now does this by default for its login generator and other tools.

    In CF7 the only way you can receive callbacks for session end and application end is through the use of Application.cfc

    If your argument is one of scalability against extensiblity, and your only basis of the argument is that CFCs are slower, then you have no argument.

    Next time you mention application performance why don't you include some actual performance data? Where are your bottlenecks? If you discuss these maybe we can suggest ways to speed up the application, whilst still giving code maximum code extensiblity.

    You will accomplish much more by asking questions and listening to others than by preaching your opinions.

    ReplyDelete
  11. Anonymous7:55 AM

    For the web my first priority is speed and the closer you are to the home page the more important speed becomes.

    I take every step to acheieve speed near the home page which includes less maintainable code and less OO-stuff.

    OO is more flexible and can help in long run maintenance, so it is used in places where the load is lighter.

    I would argue that for local apps (1 user - 1 CPU) OOP is awesome, but on web apps (100's users - 1 CPU) when the ColdFusion queue starts filling up you have to get things pumped out ASAP and you sacrifice flexiblity for speed.

    That being said, if you have enough hardware and can handle the load then my preference is to use some OO stuff, but not go nuts with it.

    The Hammer is not your only tool and not everything is a Nail. Pick an appropriate tool for the job and focus on getting the job done.

    ReplyDelete
  12. Anonymous8:26 AM

    Craig, I sometimes wonder why you post this sort of nonesense. CFCs are just for web services? Really? I didn't know you were on the requirements management team for CFMX. Interesting. Well everyone, time to scrap all your CFC-based apps and go back to cfinclude. Craig says so! Encapsulation is overrated anyway.

    But where you show a real lack of understanding is when you say things like "performance is most important". This is the root of all of your other misconceptions, I think. Performance is NOT most important, unless you're writing code for real-time NASDAQ order processing, or the space shuttle, or for a pacemaker. For 99% for applications that do not run at max load all the time, MAINTAINABILITY is most important. By a gigantic margin. All the app needs to do is perform ACCEPTABLY. And if you lose a bit of performance but gain maintainability (as you do when using CFCs correctly), that is a very worthwhile trade in almost every situation.

    Your comments about Fusebox are so far off the mark that it's barely even worth it to address them. What is clear is that you have no idea what you are talking about. I want to see a blog entry on why Fusebox isn't "coder friendly", or on why it makes any difference to the customer's "user friendly" needs if you use Fusebox. Or Mach-II or Model-Glue for that matter. This is just rubbish.

    And finally, there is a huge amount of arrogance lurking beneath these supposedly informative posts of yours. So, everyone ELSE has to get a grip on common sense, eh? Not you though. Oh no, you've got it all figured out. Then you stick with cfinlcude, building applications with (a miniscule amount of) extra performance that no one needs or asked for, while sacrificing everything that decades of experience has shown is a more effective long-term solution to building and maintaining an application. Have fun with that.

    Brian Kotek

    ReplyDelete
  13. Anonymous8:32 AM

    Also, please learn how to spell "scalable". Please?

    ReplyDelete
  14. Anonymous4:53 PM

    Hey Craig, you're right! Those imbeciles at Macromedia haven't a clue! Why not call their bluff? Offer to set up a "Craig's Coding Challenge" in which you spend a week or two at MM HQ 'refactoring' their Mach-II apps in such a way as to demonstrate the scalability, maintainability, reliability, performance and coherence of your coding style.

    Think of the advantages: the Macromedia Web site will perform faster! Macromedia's engineers will learn stuff they've never dreamed of (including just why CFCs are a really Bad Thing)! Your ideas will be vindicated and you won't have to tolerate all these ignorant protestations on your common-sense coded blog! Women will be like putty in your hands! etc.

    The fame and exposure that "Craig's Coding Challenge" will bring will also probably ensure a steady stream of job offers for the forseeable future! Go on, what have you got to lose? Kick some butt over at Macromedia!

    Roger Lancefield

    ReplyDelete
  15. Anonymous4:38 AM

    This is the most ridiculous coldfusion blog post I've seen in a long time.

    If you had to manage technical projects with any real impact and have some actual level of responsibility for the long term budgeting of such, you would quickly learn that scalability, flexibility, maintainability trump performance every day of the week.

    The ability to go in and change things quickly, having those changes cascade instantly to components that utilize their services, etc – priceless. Hmmm, $3,000 in hardware for an additional server or $3,000 in billable time EVERYTIME you want to implement a sizable change. Did I mention as the application grows, the longer that billable time becomes managing your big ball of mud?

    Do some research next time before you completely embarrass yourself with another amateur night post. Cocky people like you are the reason ColdFusion gets a bad rap.

    -Oh, and the CFC’s for web services only thing, so lame its priceless! Hahahahahahaa!

    ReplyDelete
  16. Anonymous11:28 AM

    Clearly the only reason you are bashing CFCs is because you have never used them before. My guess is you are a developer that got his start learning CF from scratch with no prior application development experience.

    When it comes to your comments on CFCs, you're simply way off base. A few other people here have already touched on things like scalabiliy and code management. If you have ever worked on an enterprise-level ColdFusion application, you should be eating your words.

    And not that I blindly believe everything that comes from Ben Forta's mouth, but I think I'd put my faith in his assessment of CFC performance over yours.

    http://www.forta.com/cf/tips/index.cfm?age=1366

    -Tyson

    ReplyDelete
  17. But I've never work in team environments with different people working on different parts of an application, perhaps it makes sense for those situations to break everything apart.

    But then why do you assume that everyone is in a team environment like you are used to and experienced with?

    Even when I have been a part of a team of developers, we still were creating our applications 100% by ourselves.

    No dividing of labor.

    If we had a dba, we'd bring the sql code, to their attention and for approval.

    But 99% of the time, I had to create everything presentation to form actions to sql code...

    I am not saying that is better than anyone else's experience.

    But since my future experiences are gonna continue to be like that, breaking applications apart may not be my best approach.

    I don't have the answers, all I want is for the quality of cf development to improve, and to improve myself along the way.

    And pray that I have something of virtue to pass on to others...

    My choice of coldfusion style is usually dependant on whoever hires me.

    To me, each method depends on the needs of the application, and who is involved with creating it.

    And please stop insulting me, because I haven't had your experiences, so therefore I am either incompetent or an idiot.

    Thank you.

    ReplyDelete
  18. Anonymous11:10 AM

    Coldfusion MX is cool. I'm a Java Developer using CF MX on my most recent project. With the introduction of CFC's and using JAVA underneath everything, Macromedia has taken good steps toward providing an object oriented solution. It is just like using Java if you choose to use it that way. If you don;t know Java or architectures and design patterns employed in the Java/J2EE world it would be good to look into as it can open up a new world to folks who had previously just been CF script writers.

    Cheers!

    ReplyDelete