• Synonymous Awkward (unregistered) in reply to Matt
    Matt:
    Carnildo:
    Matt:

    If someone can show me a language that's dumbass-proof, I'd like to see it. .NET certainly isn't. Java isn't. C++ isn't by a long shot, and as an added bonus you can do a lot more damage with C++.

    APL should be pretty dumbass-proof.

    Never used it. That being said, I've never run into a language that could protect an application, or data, from an idiot developer.

    Oh, trust me, APL protects everything from idiot developers. And all other kinds of developer, for that matter. You simply cannot write an idiotic program in it! ;o)

  • PhilD (unregistered) in reply to Matt

    I can comment on this as I have been doing a .NET project recently after years of CF development. The Master page concept in ASP.NET is great. I like it very much. But this can also be done in CF, and I'm sure in other languages, it's just not as well known and isn't really taught too much. Essentially, a page could be constructed like this:

    <cfmodule template="layout/masterLayout.cfm"> [Page content here] </cfmodule> Inside the masterLayout.cfm, one would have <cfif thisTag.ExecutionMode IS "start"> [header/nav/application stuff] <cfelse> [footer/application stuff] </cfif>

    Others also do includes for header and footers. I think ASP.NET does make it easier to work with the MasterPage, especially with the tools available, but CF does have that type of functionality.

  • (cs) in reply to Russ

    [quote user="Russ"] Well obviously, you don't understand ColdFusion. Perhaps you should read up on the docs before you make comments about things you don't know. It is obvious to everyone here that my code: [/quote]

    Russ, are you always this much of a pompous, know-it-all ass, or is it just today?

    For those of us who DON'T use CF, it isn't obvious (although I did suspect that it displayed all rows, because of the <cfoutput> using a named query). You should remember that not everyone who reads posts here uses the same language, platform, or anything else, and that what YOU happen to think is obvious may not be seen that way by others.

    For example, it's obvious to me that you're an opinionated, short-sighted individual with poor social skills. Is that obvious to you?

    Retrieves all the userid, username pairs from the users table. I meant to leave off the where clause.

    <cfoutput> automatically loops through every row in the query. I am outputting a list of users from the database, one per line, and outputting a link to the user detail page.

    Not only is your code solving totally the wrong problem, it's also missing a crucial part of the problem... the actual DAO that you're using (Which is probably at least 30 lines.

    CF has frameworks that you can use that generate the DAO's for you as well. I'm just showing what the simplest example is, and asking people to show it done better in a different language.

    Also there is no need to check for null in CF. If there are no records returned, the cfoutput doesn't run. If any of the values are null, they get converted to empty strings and no errors get thrown.

    CF Rocks!!!1five[/quote]

  • thogi (unregistered) in reply to Russ
    Russ:
    This is what the code should look like:

    file: security.cfc

    <cfcomponent name="security">
    	<cffunction name="isAdmin" returnType="boolean">
    	   <cftry>
    		  <cfreturn session.isAdmin>
    		  <cfcatch type="Any">
    			 <cfreturn false>
    		  </cfcatch>
    	   </cftry>
    	</cffunction>
    </cfcomponent>

    file: application.cfm in the admin folder.

    <cfapplication name="myApp" sessionManagement="true">
    
    <!--- Cache the cfc in application scope --->
    <cfif not StructKeyExists(application,"cfcSecurity")>
       <cfobject name="application.cfcSecurity" component="someMappingOutsideWebRootPointingToCFCFolder.security">
    </cfif>
    
    <cfif not application.cfcSecurity.isAdmin()>
         <cfif ListLast(cgi.script_name,"/") neq "login.cfm" and  ListLast(cgi.script_name,"/") neq "actLogin.cfm"> 
            <cflocation url="login.cfm" addtoken="false">
         </cfif>
    </cfif>

    Russ, not to be a pain here, but wouldn't it make more sense to do the following: In the application.cfm

    <cfapplication name="myApp" sessionManagement="true" />
    <cflogin applicationtoken="#application.applicationName#" idletimeout="30">
    <!--- database, ldap, NT , etc... code for authenticating cflogin.name and cflogin.password which retruns a boolean value for #authenticated# and the user's role(s) in a comma delimited list as #roles# --->
    	<cfif autheticated>
    		<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#roles#" />
    	<cfelse>
    		<cfinclude template="login.cfm" />
    		<cfabort>
    	</cfif>
    </cflogin>

    At the top of your admin-only page

    <cfif not isUserInRole('Admin')>
    	<cflocation url="nosoupforyou.cfm" />
    </cfif>
  • Matt (unregistered) in reply to Synonymous Awkward
    Synonymous Awkward:
    Matt:
    Carnildo:
    Matt:

    If someone can show me a language that's dumbass-proof, I'd like to see it. .NET certainly isn't. Java isn't. C++ isn't by a long shot, and as an added bonus you can do a lot more damage with C++.

    APL should be pretty dumbass-proof.

    Never used it. That being said, I've never run into a language that could protect an application, or data, from an idiot developer.

    Oh, trust me, APL protects everything from idiot developers. And all other kinds of developer, for that matter. You simply cannot write an idiotic program in it! ;o)

    Suddenly, I'm very curious.

    Tell me, can it protect your app from an idiot user? If so, I'm sold.

    Doubly so if said protection is in the form of a 50K shock through the keyboard. But I may be jaded.

  • (cs) in reply to Russ
    Russ:
    First of all, again, it's ColdFusion, not Cold Fusion.

    Who cares how it's spelled? It's still crap.

    You remind me so much of the VBA developers who build massive multi-user systems using Access, and think they're real programmers. Because you're good at working with a crappy product doesn't make that product good, or make you a programmer.

    Russ:
    Don't forget that MySpace has started out (and I believe a large part of it still is) in ColdFusion.

    Yay! A really crappy site was built with a really crappy tool, and you use that as a positive!

    Russ:
    The fact that most of their developers have no idea how to code properly

    Of course they have no idea how to code properly - they're CF developers.

    Russ:
    nonwithstanding, they were able to build one of the largest sites on the internet in CF and sell it for a lot of money.

    That has nothing to do with CF being used. It has to do with the concept behind MySpace, not the implementation of that concept. That's what they got paid lots of money for; it didn't matter what tool they used to design it.

  • PhilD (unregistered) in reply to KenW

    Please don't lump all of us CF developers in with Russ. There a language zealots in every development platform. However, you say the product is crap, but don't give any reasons why, which I think is just as bad as being a zealot. Just wondering what your justifications are for making that statement.

  • dan krüsi (unregistered) in reply to snoofle
    snoofle:
    Russ:
    durnurd:
    Russ:
    Alcari:
    The real WTF is that someone would willingly use Cold Fusion.

    The real WTF is that someone who can't even spell ColdFusion thinks he's qualified to comment on it.

    Well, think about all the other programming languages. C, PHP, SQL, VB... not very hard to spell, are they? A misplaced space here or there is rarely called a spelling error, and in most languages, it is inconsequential (I'll admit, putting it in the middle of a variable name would be a little problematic, but then English is not a strongly typed language)

    The point is that ColdFusion has not been called Cold Fusion for many, many years. The name has been changed to prevent people from confusing it with Cold Fusion term in physics. So if you've really used a recent version of ColdFusion, you should know how it's spelled, and if you don't, it means that you probably haven't used the language in many years, and shouldn't be allowed to make comments about it.

    So there are people that would actually confuse <CFxxx> with the physics concept of Cold Fusion? The conversation would need to go something like this:

    Physicist:  We need to create a web site to show our work with Cold Fusion
    Programmer: We'll do it with ColdFusion
    Physicist:  Right, Cold Fusion
    Programmer: Um, no, ColdFusion; there's no space
    Physicist:  No space for what?
    Programmer: ColdFusion
    Physicist:  (wtf?)
    

    These type of problems are just such a nuisance.

    Jeweler: We need a new back-end CMS. Programmer: We will use Perl for all the coding. Jeweler: No, wait, perl is too dull and has been around for ages. Programmer: Hmmmm, maybe you are right. What about Java or BeanShell? Jeweler: Excuse me? Please don't insult my work.

    -dan

  • Russ (unregistered) in reply to thogi
    thogi:
    Russ:
    This is what the code should look like:

    file: security.cfc

    <cfcomponent name="security">
    	<cffunction name="isAdmin" returnType="boolean">
    	   <cftry>
    		  <cfreturn session.isAdmin>
    		  <cfcatch type="Any">
    			 <cfreturn false>
    		  </cfcatch>
    	   </cftry>
    	</cffunction>
    </cfcomponent>

    file: application.cfm in the admin folder.

    <cfapplication name="myApp" sessionManagement="true">
    
    <!--- Cache the cfc in application scope --->
    <cfif not StructKeyExists(application,"cfcSecurity")>
       <cfobject name="application.cfcSecurity" component="someMappingOutsideWebRootPointingToCFCFolder.security">
    </cfif>
    
    <cfif not application.cfcSecurity.isAdmin()>
         <cfif ListLast(cgi.script_name,"/") neq "login.cfm" and  ListLast(cgi.script_name,"/") neq "actLogin.cfm"> 
            <cflocation url="login.cfm" addtoken="false">
         </cfif>
    </cfif>

    Russ, not to be a pain here, but wouldn't it make more sense to do the following: In the application.cfm

    <cfapplication name="myApp" sessionManagement="true" />
    <cflogin applicationtoken="#application.applicationName#" idletimeout="30">
    <!--- database, ldap, NT , etc... code for authenticating cflogin.name and cflogin.password which retruns a boolean value for #authenticated# and the user's role(s) in a comma delimited list as #roles# --->
    	<cfif autheticated>
    		<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#roles#" />
    	<cfelse>
    		<cfinclude template="login.cfm" />
    		<cfabort>
    	</cfif>
    </cflogin>

    At the top of your admin-only page

    <cfif not isUserInRole('Admin')>
    	<cflocation url="nosoupforyou.cfm" />
    </cfif>

    There is more then one way to skin a cat. In my solution, I check whether the user is logged in in actLogin.cfm and set session.isAdmin=1. I prefer not to use cflogin, and have never found it usefull, which is not to say that it can't be a valid solution. In your solution, however, you're not checking whether authenticated is defined when you do:

    <cfif autheticated>

    So your code will probably crash there. Another good thing about my solution is that I'm using a custom function to check whether the user is logged in, and I can replace how that function is implemented without changing any of the code that's using it.

  • Russ (unregistered) in reply to KenW
    KenW:
    Russ:
    First of all, again, it's ColdFusion, not Cold Fusion.

    Who cares how it's spelled? It's still crap.

    You remind me so much of the VBA developers who build massive multi-user systems using Access, and think they're real programmers. Because you're good at working with a crappy product doesn't make that product good, or make you a programmer.

    Russ:
    Don't forget that MySpace has started out (and I believe a large part of it still is) in ColdFusion.

    Yay! A really crappy site was built with a really crappy tool, and you use that as a positive!

    Russ:
    The fact that most of their developers have no idea how to code properly

    Of course they have no idea how to code properly - they're CF developers.

    Russ:
    nonwithstanding, they were able to build one of the largest sites on the internet in CF and sell it for a lot of money.

    That has nothing to do with CF being used. It has to do with the concept behind MySpace, not the implementation of that concept. That's what they got paid lots of money for; it didn't matter what tool they used to design it.

    My point is that a bunch of people who have no concept of good coding practices were able to sit down and write a site that blew up in popularity, and they were able to just throw more hardware at it and have it stay afloat. Now they have the budget to rewrite it in .NET, and they're still having problems doing it.

    My point is if they weren't using ColdFusion, they never wwould've become as big, as they wouldn't be able to write the code required in a different language, and they wouldn't be able to just throw more hardware at bad code to scale up.

  • Russ (unregistered) in reply to KenW

    [quote user="KenW"][quote user="Russ"] Well obviously, you don't understand ColdFusion. Perhaps you should read up on the docs before you make comments about things you don't know. It is obvious to everyone here that my code: [/quote]

    Russ, are you always this much of a pompous, know-it-all ass, or is it just today?

    For those of us who DON'T use CF, it isn't obvious (although I did suspect that it displayed all rows, because of the <cfoutput> using a named query). You should remember that not everyone who reads posts here uses the same language, platform, or anything else, and that what YOU happen to think is obvious may not be seen that way by others.

    For example, it's obvious to me that you're an opinionated, short-sighted individual with poor social skills. Is that obvious to you?

    Retrieves all the userid, username pairs from the users table. I meant to leave off the where clause.

    <cfoutput> automatically loops through every row in the query. I am outputting a list of users from the database, one per line, and outputting a link to the user detail page.

    Not only is your code solving totally the wrong problem, it's also missing a crucial part of the problem... the actual DAO that you're using (Which is probably at least 30 lines.

    CF has frameworks that you can use that generate the DAO's for you as well. I'm just showing what the simplest example is, and asking people to show it done better in a different language.

    Also there is no need to check for null in CF. If there are no records returned, the cfoutput doesn't run. If any of the values are null, they get converted to empty strings and no errors get thrown.

    CF Rocks!!!1five[/quote][/quote]

    Mostly when I see people spouting BS without a good reason. I'm sorry I assumed that everone knew ColdFusion. It's just that the code I showed is something that people learn the first day they learn ColdFusion. So if you know enough about ColdFusion to say it's crap, you should be able to understand that code. If you don't know shit about ColdFusion, you shouldn't be commenting on it as a language.

    P.S. If you're going to insult me, please learn to quote properly first.

  • Schnee (unregistered) in reply to Russ

    because it's so easy, a lot of dumbasses get into it

    Exact, though most of them find it easy after 1.5 years ;-)

  • Robert (unregistered)

    YIKES!

  • AC (unregistered) in reply to Licky Lindsay
    Licky Lindsay:
    Groovy:
    Grails -- Check it out http://www.grails.org/

    Let me get this straight.. you're actually using this site to do astro-turf marketing for your favorite framework? This is the kind of comment I expect to see on Youtube, "cute movie... there's lots of hot camgirls at emocamchicks.com".

    Wait a minute! You are actually using a comment against astro-turfing to astro-turf your ridiculous porn site? This is the type of comment I expect on Facebook, "How dare you use my profile to astro-turf you cretin, there are plenty of cretins at cretinsandkittens.net!"

  • AC (unregistered) in reply to Russ
    Russ:
    First of all, again, it's ColdFusion, not Cold Fusion.

    So, like I said, what is it that you think CF is missing?

    A space character.

  • Rene (unregistered) in reply to Matt

    Suffice it to say APL was written in amongst other things a mass of greek characters. In fact it had its own special keyboard, i.e. WTF

    Hence the comments about it being idiot proof.

  • AC (unregistered) in reply to dan krüsi
    dan krüsi:
    snoofle:
    Russ:
    durnurd:
    Russ:
    Alcari:
    The real WTF is that someone would willingly use Cold Fusion.

    The real WTF is that someone who can't even spell ColdFusion thinks he's qualified to comment on it.

    Well, think about all the other programming languages. C, PHP, SQL, VB... not very hard to spell, are they? A misplaced space here or there is rarely called a spelling error, and in most languages, it is inconsequential (I'll admit, putting it in the middle of a variable name would be a little problematic, but then English is not a strongly typed language)

    The point is that ColdFusion has not been called Cold Fusion for many, many years. The name has been changed to prevent people from confusing it with Cold Fusion term in physics. So if you've really used a recent version of ColdFusion, you should know how it's spelled, and if you don't, it means that you probably haven't used the language in many years, and shouldn't be allowed to make comments about it.

    So there are people that would actually confuse <CFxxx> with the physics concept of Cold Fusion? The conversation would need to go something like this:

    Physicist:  We need to create a web site to show our work with Cold Fusion
    Programmer: We'll do it with ColdFusion
    Physicist:  Right, Cold Fusion
    Programmer: Um, no, ColdFusion; there's no space
    Physicist:  No space for what?
    Programmer: ColdFusion
    Physicist:  (wtf?)
    

    These type of problems are just such a nuisance.

    Jeweler: We need a new back-end CMS. Programmer: We will use Perl for all the coding. Jeweler: No, wait, perl is too dull and has been around for ages. Programmer: Hmmmm, maybe you are right. What about Java or BeanShell? Jeweler: Excuse me? Please don't insult my work.

    -dan

    They should have used Ruby.

  • (cs) in reply to d.
    d.:
    seejay:
    The application I inherited was written entirely in CF with a SQL database backend. After a week of doing tweaks in the code and stabbing myself in the ear repeatedly with a pen, I pushed my boss to let me rewrite it in ASP.

    Part of me wishes I'd just left it... then I wouldn't have had to see the DB queries that were 400 lines long, consisting of copy/paste sections with one variable changed per section.

    At least it's now a quarter of the size, twice as fast, and doesn't look like a Disey programming language.

    -- Seejay

    a 400 line query is an SQL problem, not a CF problem. A complete rewrite from CF to ASP might well have made it twice as fast, but that'll probably be down to having fixed your queries and nothing else

    Where did I say that the query was a CF problem? It wasn't... it was simply part of the larger problem which was an application poorly written in CF in the first place. The several 400-line queries scattered all over the place was a sign of how badly this code needed a rewrite. If you can't figure out how to pass variables and use loops to write queries that have tiny little changes in them and instead make huge cludges of code that require someone to make 40 changes instead of one or two, then there's no way you're going to write decent code, CF or not. As it was, this was written in ColdFusion, badly, and made me want to cry.

    A combination of making the general CF -> ASP code more clean and concise, plus rebuilding the databases from the ground up and optimizing the queries made the site smaller and faster.

    The previous "developer" wasn't a coder to begin with. And he wanted to write it in ColdFusion because he didn't understand ASP or .NET. As you can imagine, even if CF can be used well and intelligently, handing it over to someone with little to no programming knowledge to begin with is a recipe for disaster. Or at least a recipe for a WTF.

    -- Seejay

  • Michael.H (unregistered)

    thats just crazy, i cant imagine what went through their minds when they wrote that... lol

  • PhilD (unregistered) in reply to seejay
    seejay:
    Where did I say that the query was a CF problem? It wasn't... it was simply *part* of the larger problem which was an application poorly written in CF in the first place. The several 400-line queries scattered all over the place was a sign of how badly this code needed a rewrite. If you can't figure out how to pass variables and use loops to write queries that have tiny little changes in them and instead make huge cludges of code that require someone to make 40 changes instead of one or two, then there's no way you're going to write decent code, CF or not. As it was, this was written in ColdFusion, badly, and made me want to cry.

    A combination of making the general CF -> ASP code more clean and concise, plus rebuilding the databases from the ground up and optimizing the queries made the site smaller and faster.

    The previous "developer" wasn't a coder to begin with. And he wanted to write it in ColdFusion because he didn't understand ASP or .NET. As you can imagine, even if CF can be used well and intelligently, handing it over to someone with little to no programming knowledge to begin with is a recipe for disaster. Or at least a recipe for a WTF.

    -- Seejay

    But the same could be said about handing ASP.NET or PHP to a "non-developer". I think that's the point too many people miss, you can build a crap site in any development language. Does CF make it easier to do so than other languages? Not sure, but I'm sure if you had done a CF -> CF migration doing the same database rebuild and componentization you did for .NET, you'd have gotten the same performance benefits. I don't want to put words in your mouth, but you probably chose to go ASP.NET because either you were more comfortable in that tool set, other applications for that company are built using that technology, or the cost to get to the latest version of CF to do what you needed to do to improve the application might have been too cost prohibitive.

  • CF Lifer (unregistered)

    Someone way up there said that he rewrote the CF code using 1/4 of the lines. Implying that all ASP applications doing the same thing as CF applications can be coded in far fewer lines

    If a good ASP programmer and a good CF programmer attempted to rewrite the original application from scratch, I bet you'd find that the new CF app would be smaller than the new ASP app. And probably be coded in less time, assuming similar skill levels in each programmers area of expertise.

    That being said, the WTF in this case has nothing to do with coldfusion.

    Bad programmers can write WTF code in ANY language, and just about any decent programmer in any language with any skill at all in web development can see that the code from this article is pretty freaking worthless.

  • CF Lifer (unregistered)

    Holy cow, and someone up there claiming to know Coldfusion talking about the <cfsession> tag and comparing it to the <cfapplication> tag.

    That dude is a moron. There is no <cfsession> tag. If he did coldfusion programming for 1.5 years, it was painful because he didn't know jack about coldfusion and probably just spent the whole time whining about how his Atari 800XL was better than someone else's Commodore 64.

  • Cloak (unregistered)

    The real WTF is these endless discussions about what is a good programming language or who is able to use one.

    If one needs to get from A to B I think it doesn't matter a lot if you use a bike or a car. You have to get to B, basta! And should every biker then say driving a car is shit and all car drivers are unable to drive. And the same for the car drivers.

    WTF! WTF! WTF!

  • Synonymous Awkward (unregistered) in reply to Matt
    Matt:
    Synonymous Awkward:
    Matt:
    Carnildo:
    Matt:

    If someone can show me a language that's dumbass-proof, I'd like to see it. .NET certainly isn't. Java isn't. C++ isn't by a long shot, and as an added bonus you can do a lot more damage with C++.

    APL should be pretty dumbass-proof.

    Never used it. That being said, I've never run into a language that could protect an application, or data, from an idiot developer.

    Oh, trust me, APL protects everything from idiot developers. And all other kinds of developer, for that matter. You simply cannot write an idiotic program in it! ;o)

    Suddenly, I'm very curious.

    Tell me, can it protect your app from an idiot user? If so, I'm sold.

    Doubly so if said protection is in the form of a 50K shock through the keyboard. But I may be jaded.

    The implication was that (as Rene pointed out) if you're smart enough to write anything non-trivial in it, you're probably also smart enough to make it not suck. :o)

    By the way, thanks for that link, Rene, I've actually been looking for a good picture of that.

  • Cloak (unregistered) in reply to CF Lifer
    CF Lifer:
    Holy cow, and someone up there claiming to know Coldfusion talking about the <cfsession> tag and comparing it to the <cfapplication> tag.

    That dude is a moron. There is no <cfsession> tag. If he did coldfusion programming for 1.5 years, it was painful because he didn't know jack about coldfusion and probably just spent the whole time whining about how his Atari 800XL was better than someone else's Commodore 64.

    Well, it's some 5 years later now (used version 4.5 and 5) and didn't remember anymore that sessions management was enabled with CFAPPLICATION. Mea maxima culpa. At least I didn't shout at CF since I remember it as a cute and easy to learn language.

    BTW: moron yourself

  • Rene (unregistered) in reply to Synonymous Awkward
    By the way, thanks for that link, Rene, I've actually been looking for a good picture of that.

    Google Image Search for "APL Keyboard" is your friend :)

  • Rene (unregistered) in reply to Synonymous Awkward
    By the way, thanks for that link, Rene, I've actually been looking for a good picture of that.

    Google Image Search for "APL Keyboard" is your friend :)

  • CF Lifer (unregistered) in reply to Cloak
    Cloak:
    Well, it's some 5 years later now (used version 4.5 and 5) and didn't remember anymore that sessions management was enabled with CFAPPLICATION. Mea maxima culpa. At least I didn't shout at CF since I remember it as a cute and easy to learn language.

    BTW: moron yourself

    Sorry, I went overboard.

    easy to learn? yes. cute? I don't know about "cute" to describe anything but an 8th grade girlfriend or a puppy.

    But CF has also grown incredibly powerful over the last 5 years - since the release of version 6 when they went to the j2ee platform, and all the stuff that Macromedia integrated into CFMX 7 and then Adobe integrated into CF 8. Components, java integration, flash integration, flex integration, PDF generation, charting, reporting, exchange integration, built in support for ajax and flash/flex remoting, integrated verity, etc etc yada yada yada.

  • CF Lifer (unregistered) in reply to Cloak
    Cloak:
    The real WTF is these endless discussions about what is a good programming language or who is able to use one.

    If one needs to get from A to B I think it doesn't matter a lot if you use a bike or a car. You have to get to B, basta! And should every biker then say driving a car is shit and all car drivers are unable to drive. And the same for the car drivers.

    I can't argue with that. Basically my point really.. bad programmers can write bad code in any language. I'm pretty sure I wrote some bad code 10 years ago when I started out with CF, though I can't think of any particular instances where I wrote anything as bad as this article talks about!

  • Cloak (unregistered) in reply to CF Lifer
    CF Lifer:
    Cloak:
    Well, it's some 5 years later now (used version 4.5 and 5) and didn't remember anymore that sessions management was enabled with CFAPPLICATION. Mea maxima culpa. At least I didn't shout at CF since I remember it as a cute and easy to learn language.

    BTW: moron yourself

    Sorry, I went overboard.

    easy to learn? yes. cute? I don't know about "cute" to describe anything but an 8th grade girlfriend or a puppy.

    But CF has also grown incredibly powerful over the last 5 years - since the release of version 6 when they went to the j2ee platform, and all the stuff that Macromedia integrated into CFMX 7 and then Adobe integrated into CF 8. Components, java integration, flash integration, flex integration, PDF generation, charting, reporting, exchange integration, built in support for ajax and flash/flex remoting, integrated verity, etc etc yada yada yada.

    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

  • Cloak (unregistered) in reply to CF Lifer
    CF Lifer:
    Cloak:
    Well, it's some 5 years later now (used version 4.5 and 5) and didn't remember anymore that sessions management was enabled with CFAPPLICATION. Mea maxima culpa. At least I didn't shout at CF since I remember it as a cute and easy to learn language.

    BTW: moron yourself

    Sorry, I went overboard.

    easy to learn? yes. cute? I don't know about "cute" to describe anything but an 8th grade girlfriend or a puppy.

    But CF has also grown incredibly powerful over the last 5 years - since the release of version 6 when they went to the j2ee platform, and all the stuff that Macromedia integrated into CFMX 7 and then Adobe integrated into CF 8. Components, java integration, flash integration, flex integration, PDF generation, charting, reporting, exchange integration, built in support for ajax and flash/flex remoting, integrated verity, etc etc yada yada yada.

    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

  • CF Lifer (unregistered) in reply to Cloak
    Cloak:
    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

    I still use HomeSite+ for my coldfusion development, they continue to release tag updates for it.

    Of course, I should be using CFEclipse, I just can't get myself to give up Homesite+

  • Russ (unregistered) in reply to Cloak
    Cloak:
    CF Lifer:
    Cloak:
    Well, it's some 5 years later now (used version 4.5 and 5) and didn't remember anymore that sessions management was enabled with CFAPPLICATION. Mea maxima culpa. At least I didn't shout at CF since I remember it as a cute and easy to learn language.

    BTW: moron yourself

    Sorry, I went overboard.

    easy to learn? yes. cute? I don't know about "cute" to describe anything but an 8th grade girlfriend or a puppy.

    But CF has also grown incredibly powerful over the last 5 years - since the release of version 6 when they went to the j2ee platform, and all the stuff that Macromedia integrated into CFMX 7 and then Adobe integrated into CF 8. Components, java integration, flash integration, flex integration, PDF generation, charting, reporting, exchange integration, built in support for ajax and flash/flex remoting, integrated verity, etc etc yada yada yada.

    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

    I don't think anyone would argue that Dreamweaver is a WTF in itself. However, if you've been involved in the CF community, you'd know that they came over that hurdle and invented CFEclipse, which still needs some work, but is better then Dreamweaver, and is official supported by Macromedia (they put their Flex IDE into Eclipse as well).

  • (cs) in reply to Matt Burgess
    Matt Burgess:
    $result = mysql_query('select * from users'); while($row = mysql_fetch_assoc($result)) $array[$row['user_id']] = $row['user_name'];

    foreach($array as $id => $data){ print $id.' is '.$data['user_name'].'
    '; }

    A better version would be

    $result = mysql_query( 'SELECT userID, userName FROM users' );
    while( list( $id, $name ) = mysql_fetch_row( $result ) ) {
        print "$name
    "; } mysql_free_result( $result );

    or similar. (Note that manually freeing the result is a must: doing otherwise will keep it in memory as long as the connection is open, which might be indefinitely; or at the very least as long as the script runs, causing memory leaks for large result sets.) I still find it to be ugly: it has too much punctuation in it, and the function names definitely suck (DBMS-specific as they are). The string escaping is less than ideal, with the double quotes having to be escaped, unlike in either CF or Python. The need to remember to manually free results or risk bugs is simply awful. Also note that the list() usage is not very typical of PHP coding, although it works fine: generally PHP coders would add a conceptually unnecessary $row variable, in my experience (whereas Python coders would invariably eschew it).

    Overall, though, it's not that bad at all. You can write clean code in almost any language, just as you can write atrocious code in almost any language.

    Matt Burgess:
    The point has to be made, though, that this is a really crap thing to do. Anyone putting inline SQL these days needs to have a really serious think about what they're doing.
    Nonsense. A snippet like that is perfectly suitable for any application that can't rely on stored procedures, such as anything that supports MySQL 4.
    Matt Burgess:
    While on the subject of the datatypes, CF has four data types for what in PHP is just an array. Structs, queries, arrays and lists.
    I should point out that I view PHP's all-inclusive arrays as a drawback, not a benefit. They're not conceptually coherent, and it shows. Almost every array function has to have two versions, one that works with keys and one with values: for instance, array_diff vs. array_diff_assoc; array_intersect vs. array_intersect_assoc. It leads to inconsistent behavior for things like array_merge, too -- quoting from the manual, "If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended."

    At the very least, the list type should be distinct from the dictionary type. Depending on the language, other distinctions are often made: C++ makes many for efficiency reasons (e.g., list vs. vector), Python makes some for utility reasons (set) and some for language principles (mutable vs. immutable).

    You honestly save much less in superficial simplicity (only one array type) than you lose in real simplicity (more functions that do the same thing, functions where you have to check the docs every time to see how they handle mixed lists/dictionaries). As someone who regrettably programs in PHP almost exclusively, I think this is characteristic of PHP. It does things because they sound like a good idea without real consideration of the consequences.

  • Matt Burgess (unregistered)

    [quote user="Simetrical"]A better version would be

    $result = mysql_query( 'SELECT userID, userName FROM users' );
    while( list( $id, $name ) = mysql_fetch_row( $result ) ) {
        print "$name
    "; } mysql_free_result( $result );

    or similar. [/quote]

    Strongly disagree. There are a lot of reasons for my way. Using an inline "while" to loop is extremely bad practise. YOu have SQL in the middle of your html, which makes it harder to find later. YOu also have a lot less flexibility. My method is actually intended to be used more as a function, like $users = getUsers() (or Users::getUsers(), better still). That way that query is more useful elsewhere, and changes to the database structure, required fields ('where active = 1', or also getting 'status') is easier.

    [quote user="Simetrical"] (Note that manually freeing the result is a must: doing otherwise will keep it in memory as long as the connection is open, which might be indefinitely; or at the very least as long as the script runs, causing memory leaks for large result sets.) [/quote] Demonstrably UNTRUE. From php.net: mysql_free_result() only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution. [quote user="Simetrical"] I still find it to be ugly: it has too much punctuation in it,

    agreed, but only for how YOU did it. Prefer: print ''.$name.'
    ;

    Or optionally, escape the php alltogether: ?>.<?=$name=?>
    <?

    [quote user="Simetrical"] and the function names definitely suck (DBMS-specific as they are).
    [/quote] Strongly agree. This is a major flaw in PHP, imho. I'd like to see PHP move to abstraction by default, though most people use mysql, so...

    [quote user="Simetrical"] The string escaping is less than ideal, with the double quotes having to be escaped, unlike in either CF or Python.
    [/quote] Agreed, but every language has things you have to escape. You can use single quotes in a hell of a lot of places, too. It's also faster. Mix and match. Go nuts.

    [quote user="Simetrical"] The need to remember to manually free results or risk bugs is simply awful. Also note that the list() usage is not very typical of PHP coding, although it works fine: generally PHP coders would add a conceptually unnecessary $row variable, in my experience (whereas Python coders would invariably eschew it). [/quote] The need to remember doesn't exist, and yes, list can be very handy. But it also assumes you know what you need from the query. Which you sometimes don't. If you want to add a new variable, like status, you have to add it in more places. $row is hardly "conceptually unnecessary". It contains all the data for the row. ALL the data, not just preselected data that you happened to need at the time. Row also doesn't care about the order.

    [quote user="Simetrical"] Overall, though, it's not that bad at all. You can write clean code in almost any language, just as you can write atrocious code in almost any language. [/quote] Agreed. I've seen some bad PHP. And some good CF. Hell, I've written some of both :D

    [quote user="Simetrical"] Nonsense. A snippet like that is perfectly suitable for any application that can't rely on stored procedures, such as anything that supports MySQL 4. [/quote] Disagree, you're mixing application and interface together which is very very bad. Why jump from that to stored proceedures? There are other options. Functions. "getUsernames()". These help keep your code lean, by getting all of your "data" at the very top, like so

    <?
    include_once('config.php');
    include_once('functions.php');//this is bad practise, but an example
    $username_array = getUsers();
    $products = getProducts();
    ?>
    <html>....
    

    It's MUCH easier to work with.

    [quote user="Simetrical"] Almost every array function has to have two versions, one that works with keys and one with values: for instance, array_diff vs. array_diff_assoc; array_intersect vs. array_intersect_assoc. It leads to inconsistent behavior for things like array_merge, too -- quoting from the manual, "If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended."

    At the very least, the list type should be distinct from the dictionary type.
    [/quote] I don't agree with a lot of this, but some of it is valid. Though array_diff and array_diff_assoc, etc do different things, in that one ignores keys and the other does not. Granted that could maybe be an argument. There are other examples like that, with eregi/ereg being a personal peeve. Why do we need two fuctions for that?!

    The other behaviour you mentioned... I've never seen that be a problem, in 10 or so years of programming in PHP.

    Bear in mind that these defenses and arguments aren't even really based on how I work myself. Everything I do is OOP and template based now. It's remarkable how much easier, faster, and more flexible it is.

    [quote user="Russ"] I still say this code is ugly. CF code is beatifull. It's very simple and elegant. I mean seriously... mysql_fetch_assoc? foreach($array as $id => $data)? If I wanted to have my code look like that, I'd stick with building cgi apps in perl. [/quote] This is really remarkably dumb. Sorry, but... your argument that your language has "prettier" code is arbitrary and totally subjective. By contrast I think CF is a very ugly looking language, with its hideous nested tags, full caps everywhere and random acts of #. But I'd never consider that as a flaw of a language. CF script looks OK. At least you can assign stuff "properly". CFSET my ass. Elegant code is readable, effective, intelligent code. Your argument is not only strange, but specious. [quote user="Russ"] You have #num# item<cfif num neq 1>s</cfif> in your shopping cart.

    Looks like cf's version is actually a character less...
    [/quote] Because it DOES less. Mine is an if/else. Yours is an if. I just didn't need to use the else.

    You are a<cfif age GT 18>n</cfif> <cfif age GT 18>adult<cfelse>child</cfif>.
    You are a<?=($age>18?'n':'')?> <?=($age>18?'adult':'child')?>.
    

    I'm not saying it's so so hard in CF, but things like <?=($i%2?'#EBEBEB':'')?> are very handy (background colour on alternating rows).

    [quote user="Russ"] Ok, so this is twice as long as php, but only because CF doesn't have a built in function to format the date like that. If you wanted something normal though, such as this

    Today is #DateFormat(Now(),"full")# [Thursday, September 20, 2007]
    

    How long would that take in php? [/quote] Who's to say what's NORMAL!? I prefer to format my dates as above because they look more human. 2nd looks more natural than 2. Ditto the "of". You ever had a client say they want the date formatted in a particular way? Because I have. "only because CF doesn't have a built in function to format the date like that". Well... yeah, wasn't that kind of my point?

    As for how long that would take?

    Today is <?=date('l, F j, Y')?>
    

    A few seconds. Want to know how many days in the month? What week of the year it is? Whether it's a leap year? CF's date handling is less advanced than Javascript's.

    [quote user="Russ"] I believe CF8 is inroducing things like ++, and as far as ucwords, even though I think that's better done in css, there are UDF's (User Defined Functions) available on cflib to do things like this, so it's not really an issue. [/quote] CF is indeed introducing some things. That may be one of them, not sure. The improvements are mostly to CFSCRIPT, though. Something ucwordsish can indeed be done in CSS, but that assumes two things. One is that you want to do that. I prefer all my data to be ready and waiting, not to have to shoehorn CSS into it to make it look right. Secondly, not everything is HTML. I often use PHP to generate XML for RSS, or for HTML text.

    foreach($_POST as $key => $value){
    $msg .= ucwords(str_replace('_',' ',$key)).": ".$value."\n";
    }
    

    Surprisingly handy bit of code. As for UDFs, the concept that "user defined functions make up for a lack of built in functions" is iffy at best. It's a programming language. ANYTHING can be done as a user defined function. The question point is that it shouldn't have to be.

    [quote user="Russ"] (Re:OOP)What exactly is so terrible about it? [/quote] The objects aren't objects. They're fake objects. They contain no state data. They're basically just collections of factory methods to access a scope (application or session, for example). They're classes, but without objects.

    [quote user="Russ"] Although I don't really know what code behind is, if you say it's the best thing since slided bread, I believe you. It still doesn't fix the fact that other languages let you mix presentation logic with business logic as well. [/quote] I don't know either. :) And yes, other languages do it. PHP is rife with it. But CF seems to be INTENDED to do it. It ENCOURAGES it.

    [quote user="Russ"] My point is that a bunch of people who have no concept of good coding practices were able to sit down and write a site that blew up in popularity, and they were able to just throw more hardware at it and have it stay afloat. Now they have the budget to rewrite it in .NET, and they're still having problems doing it.

    My point is if they weren't using ColdFusion, they never wwould've become as big, as they wouldn't be able to write the code required in a different language, and they wouldn't be able to just throw more hardware at bad code to scale up. [/quote]

    Myspace, that's a bad example. It's very clumsy and difficult to use. But that's not that relevant. Good or bad it could have been made just the same in any language. You seem to think that they one day a bunch of hairdressers just sat down with a CF book and made it. Nonsense. They could have done the same with PHP, or ASP, or JSP, and I'm willing to bet they hired someone to write it. What language is completely arbitrary.

    If you want a REAL contrast, I'll see your MySpace and raise you a Wikipedia. Note features that couldn't be done in CF, or at least aren't natively supported, such as URL rewriting.

    Oh, just as a parting note - There are two things I wish PHP had that CF has: CFDUMP is very nice compared to PHP equivs. And the application scope. PHP's architecture is drastically different, so there's no such thing. But occasionally I wish there was. :(

  • Russ (unregistered) in reply to Matt Burgess
    Matt Burgess:
    Russ:
    You have #num# item<cfif num neq 1>s</cfif> in your shopping cart. Looks like cf's version is actually a character less...
    Because it DOES less. Mine is an if/else. Yours is an if. I just didn't need to use the else.

    You are a<cfif age GT 18>n</cfif> <cfif age GT 18>adult<cfelse>child</cfif>. You are a<?=($age>18?'n':'')?> <?=($age>18?'adult':'child')?>.

    I'm not saying it's so so hard in CF, but things like <?=($i%2?'#EBEBEB':'')?> are very handy (background colour on alternating rows).

    #iif(i mod 2,de("##EBEBEB"),DE(""))#

    Sure it's a little longer then PHP's version, but not terribly difficult to do. Lets say PHP wins on the short if/else statements.

    Matt Burgess:
    Russ:
    Ok, so this is twice as long as php, but only because CF doesn't have a built in function to format the date like that. If you wanted something normal though, such as this
    Today is #DateFormat(Now(),"full")# [Thursday, September 20, 2007]
    
    How long would that take in php?
    Who's to say what's NORMAL!? I prefer to format my dates as above because they look more human. 2nd looks more natural than 2. Ditto the "of". You ever had a client say they want the date formatted in a particular way? Because I have. "only because CF doesn't have a built in function to format the date like that". Well... yeah, wasn't that kind of my point?

    As for how long that would take?

    Today is <?=date('l, F j, Y')?>
    

    A few seconds. Want to know how many days in the month? What week of the year it is? Whether it's a leap year? CF's date handling is less advanced than Javascript's.

    CF just uses the functions that Java provides. I believe it has all the other functions you're talking about. As I demonstrated, even if CF doesn't format a date the way you want (which I've never seen anyone use, ever), it's fairly simple to write a few lines of code that do it.
    Matt Burgess:
    Russ:
    I believe CF8 is inroducing things like ++, and as far as ucwords, even though I think that's better done in css, there are UDF's (User Defined Functions) available on cflib to do things like this, so it's not really an issue.
    CF is indeed introducing some things. That may be one of them, not sure. The improvements are mostly to CFSCRIPT, though. Something ucwordsish can indeed be done in CSS, but that assumes two things. One is that you want to do that. I prefer all my data to be ready and waiting, not to have to shoehorn CSS into it to make it look right. Secondly, not everything is HTML. I often use PHP to generate XML for RSS, or for HTML text.
    foreach($_POST as $key => $value){
    $msg .= ucwords(str_replace('_',' ',$key)).": ".$value."\n";
    }
    
    Surprisingly handy bit of code. As for UDFs, the concept that "user defined functions make up for a lack of built in functions" is iffy at best. It's a programming language. ANYTHING can be done as a user defined function. The question point is that it shouldn't have to be.

    Well maybe CF doesn't have ucwords. Personally I've never had to use it. Anything can be done in a user defined function? Really? Can you generate the webpage as a pdf? Can you call java methods? Can you invoke .NET objects? Can you integrate with Exchange server? Can you fill out PDF forms?

    Lets face it. There are things that CF can do that PHP will probably never be able to do without using external tools.

    Matt Burgess:
    Russ:
    (Re:OOP)What exactly is so terrible about it?
    The objects aren't objects. They're fake objects. They contain no state data. They're basically just collections of factory methods to access a scope (application or session, for example). They're classes, but without objects.

    It really depends on how you use them. True, they don't have a built in contructor, but it has become convention to use the init method as the constructor. Any variables not vared with the var keyword become instance variables.

    So even though they're a little weird, CFC's can do pretty much everything a real class can.

    Matt Burgess:
    Russ:
    Although I don't really know what code behind is, if you say it's the best thing since slided bread, I believe you. It still doesn't fix the fact that other languages let you mix presentation logic with business logic as well.
    I don't know either. :) And yes, other languages do it. PHP is rife with it. But CF seems to be INTENDED to do it. It ENCOURAGES it.
    I really don't see how it encourages it any more then PHP or most other languages do.
    Matt Burgess:
    If you want a REAL contrast, I'll see your MySpace and raise you a Wikipedia. Note features that couldn't be done in CF, or at least aren't natively supported, such as URL rewriting.

    I'm not sure what language URL rewriting it supported in, but you can do it using a 404 handler in CF. Personally, I prefer to use Apache for URL rewriting.

  • Matt Burgess (unregistered)
    Russ:
    As I demonstrated, even if CF doesn't format a date the way you want (which I've never seen anyone use, ever), it's fairly simple to write a few lines of code that do it.

    A few lines of code is a lot more complex than a single unified function. But anyway, the main thing I wanted to point out is "I've never seen anyone use, ever". Maybe because they can't? If you mean on the web, surely you're just not looking. People use all sorts of random date formats. My criticism of CF is that it locks you into a preset format (well, format templates, I guess). Sure, you might be happy with those presets. But I'm not.

    Russ:
    Well maybe CF doesn't have ucwords. Personally I've never had to use it. Anything can be done in a user defined function? Really?
    Again, the fact that you've never used something doesn't make it not useful. You've never used it because you never could.

    If not in functions then in libraries:

    Can you generate the webpage as a pdf? Yes, though the thought horrifies me. I hate PDF. Can you call java methods? Indeed, though it's still a bit Beta, apparently. But why would you want to? Can you invoke .NET objects? Indeed. Can you integrate with Exchange server? Yep. Can you fill out PDF forms? Yep.

    Your questions were kind of leading, though. Like me asking "can it run on apache?!".

    PDF is an Adobe product. Coldfusion is an Adobe product. As is Flash, etc. Do Adobe products provide better support for Adobe products than non-Adobe products? Yes. I'm not even going to bother arguing it. And I'm not arguing that CF doesn't have a place, especially where extensive cross-program Adobe stuff occurs(flex, flash remoting, pdf, etc) . But your suggestion seemed to me that CF is the only option at all times. IMHO it rarely is. And in all other times, it's rarely the best option. It's more expensive, and it's slower.

    Russ:
    So even though they're a little weird, CFC's can do pretty much everything a real class can.
    Sure, but... so can 8000 lines of procedural code. I'm not arguing its eventual result, just its sloppy implementation.
    Russ:
    I'm not sure what language URL rewriting it supported in, but you can do it using a 404 handler in CF. Personally, I prefer to use Apache for URL rewriting.
    Yeah, it's handled by the web server, which translates the requests by regex rules and then sends them to whatever language. Generally PHP.

    Do you actually use Apache for CF? I didn't know that was possible. If not... why mention it?

  • Russ (unregistered) in reply to Matt Burgess
    Matt Burgess:
    Russ:
    As I demonstrated, even if CF doesn't format a date the way you want (which I've never seen anyone use, ever), it's fairly simple to write a few lines of code that do it.

    A few lines of code is a lot more complex than a single unified function. But anyway, the main thing I wanted to point out is "I've never seen anyone use, ever". Maybe because they can't? If you mean on the web, surely you're just not looking. People use all sorts of random date formats. My criticism of CF is that it locks you into a preset format (well, format templates, I guess). Sure, you might be happy with those presets. But I'm not.

    As I mentioned, CF uses Java's date format methods. So the same methods are available to me in CF that are available to any J2EE server. If you're saying that PHP's dateformat functions are more powerfull, then OK, you win that point.

    Matt Burgess:
    Russ:
    Well maybe CF doesn't have ucwords. Personally I've never had to use it. Anything can be done in a user defined function? Really?
    Again, the fact that you've never used something doesn't make it not useful. You've never used it because you never could.

    If not in functions then in libraries:

    Can you generate the webpage as a pdf? Yes, though the thought horrifies me. I hate PDF. Can you call java methods? Indeed, though it's still a bit Beta, apparently. But why would you want to? Can you invoke .NET objects? Indeed. Can you integrate with Exchange server? Yep. Can you fill out PDF forms? Yep.

    Your questions were kind of leading, though. Like me asking "can it run on apache?!".

    PDF is an Adobe product. Coldfusion is an Adobe product. As is Flash, etc. Do Adobe products provide better support for Adobe products than non-Adobe products? Yes. I'm not even going to bother arguing it. And I'm not arguing that CF doesn't have a place, especially where extensive cross-program Adobe stuff occurs(flex, flash remoting, pdf, etc) . But your suggestion seemed to me that CF is the only option at all times. IMHO it rarely is. And in all other times, it's rarely the best option. It's more expensive, and it's slower.

    Yes, ColdFusion is more expensive then PHP. Whether or not it's slower is debatable. CF gets compiled to pure java, while PHP is interpreted. CF can cache things in the application scope for example. CF has query caching. CF has query of queries. CF lets you scale easier.

    Personally, I feel that CF lets you code applications faster then PHP. This cuts down on development time, and therefore brings a better ROI. If you're a small shop and can't afford CF licensing, shared hosting is not that much more expensive. If you're a big shop, CF license is almost nothing compared to some of the other software you might be buying (such as WAS). Even windows licensing can run more then CF, and CF can run well on linux and apache.

    Russ:
    So even though they're a little weird, CFC's can do pretty much everything a real class can.
    Sure, but... so can 8000 lines of procedural code. I'm not arguing its eventual result, just its sloppy implementation.
    Matt Burgess:
    Russ:
    I'm not sure what language URL rewriting it supported in, but you can do it using a 404 handler in CF. Personally, I prefer to use Apache for URL rewriting.
    Yeah, it's handled by the web server, which translates the requests by regex rules and then sends them to whatever language. Generally PHP.

    Do you actually use Apache for CF? I didn't know that was possible. If not... why mention it?

    Why would you assume that Apache sends things usually to PHP? Just because you've only done it with PHP? There are many other languages out there, even if you look at the open source ones on the linux platform. Ruby, Perl, Python come to mind.

    Of course I use Apache with CF. IIS is a piece of crap. We unfortunatelly host on Windows though. I'd like to go to pure linux, but our app is sort of locked into MS SQL server. I might eventually move all the other servers in the farm to Linux and just keep one or two for MS SQL on windows.

    But yea, of course I use Apache. It rocks. Open Source rocks. It's just unfortunate that there is nothing out there that's free and as good as CF. I wish there was, but there really isn't. PHP might be almost as powerful as CF (minus the Adobe integration), but it still requires more thinking and more memorization of obscure function names, and knowing good coding practices. CF just makes things easier. A lot easier.

    How many PHP coders know how to prevent SQL injection properly? ColdFusion pretty much does it for you most of the time. The other 10% of the time, there is a tag that helps you bind parameters to the query making SQL injection impossible.

    I'll admit, I've never done PHP. I've done some ASP work in the past and found it to be pure HELL. This was before .NET, but it left a bad taste in my mouth, and I never want to go back.

    I've done web programming in Perl. I've done it in Pro*C. I've done in in Java. Nothing comes even close in ease of use that CF provides.

    I think the only reason you hate CF is because it's a commercial product. It's not OpenSource, so it must be bad. There are a lot of CF implementations now, but unfortunately none of them are free. (BlueDragon has a free version I believe for non commercial use. CF's developer version is free, but that's about it). Unfortunately most CF developers don't understand programming well enough to create their own CFML interpreter, and the ones that actually do it, choose to make money off their hard work.

    I'm sure eventually there will be a OpenSource version of CF. It won't have all the bells and whistles that are in Adobe's version, but it will support the core language. And I don't think this time is far off, so you better get ready for it. Because once it becomes OS, I think there will be a lot more interest in it from the OS community, and all would be bashers might just embrace it.

  • Russ (unregistered) in reply to Matt Burgess
    Matt Burgess:
    Can you call java methods? Indeed, though it's still a bit Beta, apparently. But why would you want to?

    Why would I want to use Java? Umm... all the cool Open Source software that I can use. Lucene for one. I'm pretty sure Lucene doesn't have a PHP API.

  • Cloak (unregistered) in reply to CF Lifer
    CF Lifer:
    Cloak:
    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

    I still use HomeSite+ for my coldfusion development, they continue to release tag updates for it.

    Of course, I should be using CFEclipse, I just can't get myself to give up Homesite+

    I still have Homesite 5 lying around somewhere but it always comes up with a reminder screen. Did you buy your version?

  • Synonymous Awkward (unregistered) in reply to Rene
    Rene:
    By the way, thanks for that link, Rene, I've actually been looking for a good picture of that.

    Google Image Search for "APL Keyboard" is your friend :)

    I say "looking", I mean "thinking about looking". :-)

  • Cloak (unregistered) in reply to Matt Burgess
    Matt Burgess:
    Do you actually use Apache for CF? I didn't know that was possible. If not... why mention it?

    The European commission is running CF on Apache for their Personnel Selection Office http://europa.eu/epso/competitions/planned_en.cfm with Oracle as the backend. Several thousand hits a day especially when a new competition starts. Then it can be thousands per some minutes.

  • Russ (unregistered) in reply to Cloak
    Cloak:
    CF Lifer:
    Cloak:
    I still used 6 for some months but since version 5 this was Macro Media's "product" and that gave rise to the biggest WTF: NightmareWaver. I started hating using CF by then, but not so much for the language, just the editor. And re-installing 4.5's editor was practically impossible (missing CDs).

    I still use HomeSite+ for my coldfusion development, they continue to release tag updates for it.

    Of course, I should be using CFEclipse, I just can't get myself to give up Homesite+

    I still have Homesite 5 lying around somewhere but it always comes up with a reminder screen. Did you buy your version?

    Homesite+ comes with Dreamweaver AFAIK. Adobe knows that dreamweaver is a piece of crap when it comes to coding, and that's why homesite comes with it for free.

  • (cs) in reply to Matt Burgess
    Matt Burgess:
    Strongly disagree. There are a lot of reasons for my way. Using an inline "while" to loop is extremely bad practise. YOu have SQL in the middle of your html, which makes it harder to find later. YOu also have a lot less flexibility. My method is actually intended to be used more as a function, like $users = getUsers() (or Users::getUsers(), better still). That way that query is more useful elsewhere, and changes to the database structure, required fields ('where active = 1', or also getting 'status') is easier.
    If it were in a function, obviously your way would be superior.
    Matt Burgess:
    Demonstrably UNTRUE. From php.net: mysql_free_result() only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution.
    From php.net comments on that very page: "I just encountered a bug in my code where I forgot to use this function. I also happen to be using mysql_pconnect() for a persistent connection. If you forget to free the result, it can hold the old result set open indefinitely within the HTTP process."

    Which is correct? I don't know, but I'd be inclined to trust a user report marginally more than documentation, as proof by counterexample. Thus I said "keep it in memory as long as the connection is open, which might be indefinitely; or at the very least as long as the script runs, causing memory leaks for large result sets". Either way, it's a Bad Idea not to call it.

    Matt Burgess:
    Simetrical:
    I still find it to be ugly: it has too much punctuation in it,
    agreed, but only for how YOU did it. Prefer: print ''.$name.'
    ;

    Or optionally, escape the php alltogether: ?>.<?=$name=?>
    <?

    That has considerably more punctuation marks than my version.

    Matt Burgess:
    yes, list can be very handy. But it also assumes you know what you need from the query. Which you sometimes don't. . . . [etc., etc.]
    I was writing for one specific example. In this specific example, my code is shorter, simpler, and faster than yours (faster because it's one-pass instead of two-pass). I wasn't writing general-purpose reusable code; if I wanted that I would have declared a function.
    Matt Burgess:
    Disagree, you're mixing application and interface together which is very very bad. Why jump from that to stored proceedures? There are other options. Functions. "getUsernames()".
    I'll grant, yes, you normally don't want to have SQL queries and presentation code in the same function. I wasn't immediately sure what you meant by "inline SQL". It's sort of hard to write a short example that doesn't mix application and display logic, though.
    Matt Burgess:
    I don't agree with a lot of this, but some of it is valid. Though array_diff and array_diff_assoc, etc do different things, in that one ignores keys and the other does not. Granted that could maybe be an argument.
    But if you had two different array types, you wouldn't have to have a separate argument, because you wouldn't need a syntactic function call at all. You could just type $foo - $bar and rest assured that it would subtract them as lists or maps, whichever they are.
    Matt Burgess:
    The other behaviour you mentioned... I've never seen that be a problem, in 10 or so years of programming in PHP.
    Well, I'm talking about elegance and conceptual simplicity, which is always very subjective. I personally don't like PHP's approach at all to the array type (or, well, most of the rest of what it does).
    Matt Burgess:
    If you want a REAL contrast, I'll see your MySpace and raise you a Wikipedia.
    Funny you should mention that, because I'm a MediaWiki developer and can say most of us hate PHP. The lead developer, Brion Vibber, is a Pythonist as I am.
    Matt Burgess:
    Note features that couldn't be done in CF, or at least aren't natively supported, such as URL rewriting.
    URL rewriting is done by Apache, not MediaWiki.
  • (cs) in reply to Russ
    Russ:
    CF is the easiest and the best language for web development.
    No.

    PHP isn't either, just so you know.

    Rarely known fact: both were created exclusively for web development.

    Coincidence?

    I DON'T THINK SO, BUT YOU DECIDE

    Matt:
    If someone can show me a language that's dumbass-proof, I'd like to see it. .NET certainly isn't. Java isn't. C++ isn't by a long shot, and as an added bonus you can do a lot more damage with C++.
    Haskell.

    Idiots will melt their brains before they manage to output a hello world, and that's before they reach monads.

    Russ:
    With CF, even dumbasses can be moderately successful and write sort of working applications.
    Hay, sounds like PHP to me.
    Russ:
    I mean what's more elegant and simple then: <cfquery name="users" datasource="mydsn"> select userID, userName from users </cfquery> <cfoutput query="users"> #userName#
    </cfoutput>
    Something along the lines of
    <% Users.find(:all) do |user| %>
        <%= link_to user.name, :action => view, :id => user.id %>
    <% end %>
    maybe.
    Russ:
    CF was designed from the ground to be a web programming language
    Once again, just like PHP
    Russ:
    This is why it's designed with tags
    You make it sound like it's a good thing...
    Russ:
    you don't have to do any funky string concatenation all over the place.
    I never do string concatenation, CGI/C isn't the only way to create web page you know.
    Matt:
    Suddenly, I'm very curious.

    Tell me, can it protect your app from an idiot user? If so, I'm sold.

    Doubly so if said protection is in the form of a 50K shock through the keyboard. But I may be jaded.

    It uses a nonstandard set of symbols and a specific, custom-made symbol. APL's creator, Kenneth E. Iverson, considered that the language you used had an impact on the way you think (which is true), so he set out to write a whole language to express computations.

    As a result, APL is completely unreadable when you don't know it (Perl doesn't come anywhere close), basically it's like learning a whole new human language.

    Russ:
    I'm not sure what language URL rewriting it supported in
    Any Python or Ruby framework worth using trivially supports declarative url rewriting.
    Matt Burgess:
    If you want a REAL contrast, I'll see your MySpace and raise you a Wikipedia.
    Writing good software doesn't mean you're using good tools, it just makes it easier.

    Wikipedia isn't good because of PHP, it's good because of the hard work and dedication of the mediawiki devs, and in spite of PHP.

    Matt Burgess:
    Note features that couldn't be done in CF, or at least aren't natively supported, such as URL rewriting.
    URL rewriting isn't natively supported either in PHP
  • smash (unregistered) in reply to Licky Lindsay
    Licky Lindsay:
    Groovy:
    Grails -- Check it out http://www.grails.org/

    Let me get this straight.. you're actually using this site to do astro-turf marketing for your favorite framework? This is the kind of comment I expect to see on Youtube, "cute movie... there's lots of hot camgirls at emocamchicks.com".

    lol... I'm new to WTF and I didn't get the joke on the emocamgirls at first

    captcha: pirates --> is it talkink about my Windows or my apps?

  • It's Me (unregistered) in reply to AC
    AC:
    Russ:
    First of all, again, it's ColdFusion, not Cold Fusion.

    So, like I said, what is it that you think CF is missing?

    A space character.

    AC, FTW!!

    /golf clap.

  • It's Me (unregistered) in reply to Russ
    Russ:
    P.S. If you're going to insult me, please learn to quote properly first.
    hmm... it seems like your snappy comeback came back to bite you in your own post.

    Russ, I've posted a few times in this thread and have been watching your posts with both interest and disbelief. I'm not sure whether you're trying to convince the WTF community or yourself that CF is a valid and relevant tool in 2007. Either way, you need to take a step back and realize that when people are criticizing CF, they're not criticizing you, they just haven't been able to fit it into the niche that you have so aptly slotted it. It doesn't mean either of you are wrong, just that you're going to have to agree to disagree.

    Pointing out trivial errors like an errant space in the CF name (really, who gives a fuck if it's ColdFusion, Cold Fusion or c01dFu5io!!11o!!!n, we all know what you're talking about), or miniscule differences in code ("well, it looks like CF did it in one less character!") doesn't endear you to me, nor likely the rest of the WTF community. We simply brand you as either a kook or a CF cheerleader (suspecting that you might be on Adobe's payroll), and stop listening to you entirely. Then your posts become less about the facts contained therein, and more about the entertainment value. And at that point, yes, we are laughing at you.

    Maybe it's Internet bravado, or maybe, as another user suggested, you are just a pompous ass who lacks basic social graces; I can't know. But before I sign off, I can leave you with the immortal words of Sgt. Hulka...

    "Lighten up, Francis."

  • It's Me (unregistered) in reply to Matt Burgess
    Matt Burgess:
    <?
    include_once('config.php');
    include_once('functions.php');//this is bad practise, but an example
    $username_array = getUsers();
    $products = getProducts();
    ?>
    <html>....
    
    . Once again, I have to ask (and I'm asking because I'm trying to improve my abilities, not because I question your methods), if you wouldn't include a single function file, how would you do it? What's good practice here? Links to alternatives (since I'm not even sure what to google for)?

    I see similar code to the above all the time, both from pro developers and admittedly, from hacks like myself (self-taught, learning as we go out of necessity). What's the better way? :)

    /and what the hell's a gygax?!?

  • Matt Burgess (unregistered)

    I wasn't going to post again, because there seemed little point, and I have no issue with conceding the last word. But someone asked a valid question.

    Regarding the "bad practise" of including a "functions.php" file. To be completely honest, there's nothing too bad about it. Don't include a functions.inc file, though, because if someone goes to functions.inc they'll get a text version of your file. Which could include all sorts of things from DB details to... you know... secret stuff.

    I was told a long time ago that a "functions.php" file was bad practise and I don't use it now because I use OO and all my classes are seperate includes.

    There are probably better ways to do things than "functions.php" such as seperating them into relevant functions or using classes. Your functions.php file can get pretty big on a complex site, and hard to work with.

    But for a small or medium sized site, sure, go ahead. I did it for years. I mostly put that comment in there to stop people from saying "Hey! That's bad practise!" :)

Leave a comment on “Ph33r my 5k1llz!”

Log In or post as a guest

Replying to comment #:

« Return to Article