A common gripe amongst ColdFusion detractors is its tag-based syntax. And to be honest, who could blame them? There is an endless collection of CFML code on the Internet that uses CF tags instead of CFScript notation. This, in spite of CFML's support of script-based syntax since 1998. Granted, the provision was limited until version 9, but that was 4 years ago.
While some developers like the tag-style syntax, for those who don't it's easy to understand why the perception is that this is how CFML applications are coded.
The following examples are comparing straight CFML with CFScript and are taken from Adobe's own help page.
About CFScript
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0a0e0-7ffe.html
First using CFML
Second using CFScript
While some developers like the tag-style syntax, for those who don't it's easy to understand why the perception is that this is how CFML applications are coded.
The following examples are comparing straight CFML with CFScript and are taken from Adobe's own help page.
About CFScript
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0a0e0-7ffe.html
First using CFML
<cfif IsDefined("Form.submit")> <cfif (Form.lastname NEQ "") AND (Form.department NEQ "")> <cfset employee = structnew()> <cfset employee.firstname = Form.firstname> <cfset employee.lastname = Form.lastname> <cfset employee.email = Form.email> <cfset employee.phone = Form.phone> <cfset employee.department = Form.department> <cfoutput> Adding #Form.firstname# #Form.lastname#<br /> </cfoutput> <cfelse> <cfoutput> You must enter a Last Name and Department.<br /> </cfoutput> </cfif> </cfif>
Second using CFScript
<cfscript> if(IsDefined("Form.submit")) { if((Form.lastname NEQ "") AND (Form.department NEQ "")) { employee = StructNew(); employee.firstname = Form.firstname; employee.lastname = Form.lastname; employee.email = Form.email; employee.phone = Form.phone; employee.department = Form.department; WriteOutput("Adding #Form.firstname# #Form.lastname#<br />"); } else { WriteOutput("You must enter a Last Name and Department.<br />"); } } </cfscript>It's a safe bet that anyone still making this case against ColdFusion/CFML isn't close enough to the technology to be in a position to be making the case in the first place.
Comments
Post a Comment