Coldfusion Components also known as CFC's. A lot of people program Coldfusion and not use CFC's have; it's too hard to learn! It's too hard to learn?? No way!!

It's very easy to learn. It's just an other way of thinking than you're used to. You must see CFC's as building blocks. By constructing "building blocks" you're code is much cleaner and far more reusable, thus quicker to build your application. Most (if not every) ColdFusion Developer knows UDF's (User Defined Functions) and Custom Tags. CFC's are almost the same as Custom Tags, but have some differences:

  • Custom Tags have a single entry point; CFC's can have multiple entry points. This makes it possible to create a single component that does many related actions. (To do that with custom tags you would need multiple tags or cumbersome switch processing.)
  • Custom Tags have no formalized parameters passing and validation mechanism; CFC's do. In other words unlike custom tags, CFC's can validate passed data, enforce data types, check for required parameters, and optionally assign default values.
  • Custom Tags cannot persist; CFC's can. Custom Tags are blocks of code that are executed as is, while CFC's are objects and can be treated as such.
  • Custom Tags are designed to contain code; CFC's are designed to contain both code and data.
  • Custom Tags are accessible only by Coldfusion and only locally; CFC's can be accessed as web services, opening up a whole new world of reuse possibilities.

To sum it up, CFC’s and Custom Tags are quite different. Although their functionality does overlap a little, they really do not solve the same problems at all. So to learn the basics of CFC's while head right on it and start with some sample "spaghetti code" and transform it to a structured and reusable way; a CFC. Please note that this article only covers the basics of CFC's and does not handle any advanced topics.



More Information visit ColdFusion Development.


Looping is a programming technique that repeats a set of instructions or displays output repeatedly until one or more conditions are met.

The first thing that we need to do it to query a database

This tag supports the following types of loops:

  • cfloop: index loop
  • cfloop: conditional loop
  • cfloop: looping over a date or time range
  • cfloop: looping over a query
  • cfloop: looping over a list, a file, or an array
cfloop: index loop

An index loop repeats for a number of times that is determined by a numeric value. An index loop is also known as a FOR loop.

Syntax



Example
The loop index is #LoopCount#.

cfloop: conditional loop

A conditional loop iterates over a set of instructions as long as a condition is True. To use this type of loop correctly, the instructions must change the condition every time the loop iterates, until the condition is False. Conditional loops are known as WHILE loops, as in, "loop WHILE this condition is true."

Syntax



Example
The following example increments CountVar from 1 to 5.



cfloop: looping over a date or time range

Loops over the date or time range specified by the from and to attributes. By default, the step is 1 day, but you can change the step by creating a timespan. The cfloop tag loops over tags that cannot be used within a cfoutput tag.

Syntax




Example

The following example loops from today's date to today's date plus 30 days, stepping by 7 days at a time and displaying the date:



cfloop: looping over a query

A loop over a query executes for each record in a query record set. The results are similar to those of the cfoutput tag. During each iteration, the columns of the current row are available for output. The cfloop tag loops over tags that cannot be used within a cfoutput tag.

Syntax



Example



cfloop: looping over a list, a file, or an array

Looping over a list steps through elements contained in any of these entities:

A variable
A value that is returned from an expression
An array
A file
Looping over a file does not open the entire file in memory.

Syntax



Example

This loop displays four names:


You can put more than one character in the delimiters attribute, in any order. For example, this loop processes commas, colons, and slashes as list delimiters:



ColdFusion skips the second and subsequent consecutive delimiters between list elements. Thus, in the example, the two colons between "George" and "Ringo" are processed as one delimiter.

To loop over each line of a file, use the tag as follows:



To read a specified number of characters from a text file during each iteration of the loop, use the tag as follows:



To loop over an array, you can do the following:




More Information visit ColdFusion Development.


Challenges Facing by Coldfusion in 2009

Posted by semaphore007 | 9:55 PM

A year ago, I challenged the community to evangelize ColdFusion and convert new developers from other technologies. It was part of a blog post that examined and rebuffed several common arguments that often arise within the community as to why ColdFusion is not more popular. Most of those arguments focus on what people think Adobe should do to make ColdFusion more popular. A lot has happened in the last year since that blog post so I want to revisit the arguments and see where we stand today.

ColdFusion needs to be taught in schools. I argued that many programmers don’t use the languages they learn in school and, of course, almost all CFers are using a language they learned after leaving school! In 2008, Adobe announced that ColdFusion 8 would be made available for free to all students and faculty for teaching purposes and Adobe also committed to working on course curriculum materials to help push ColdFusion into schools. It’ll be interesting to see how successful this is but it will take several years before we can judge the results. +1 to Adobe.

ColdFusion needs to be free and/or open source. I argued that cost was a bit of a red herring because folks need to look at “total cost of ownership”. See the ColdFusion Evangelist Kit Adobe have produced for more information on that. So what about “free and/or open source”? Well, Open BlueDragon was released as open source in 2008, based on BlueDragon 7 so it’s a solid, well-established product. Railo released their 3.0 Community Edition which is free for production use and it’s also very full-featured (and very fast). Railo will be releasing their product as open source in early 2009, under the jboss.org umbrella, part of the Red Hat group. So now you have both free and open source options. Oh, and there’s also free hosting now for ColdFusion! +1 to OpenBD and Railo.

Adobe needs to provide more ColdFusion evangelists. I argued that other popular technologies (PHP, Ruby on Rails, Groovy/Grails, Python etc) have no paid evangelists, just the community. The economy makes it hard for any company to support extensive evangelism and makes it almost impossible to increase the amount of paid evangelism. At MAX, Adobe talked about their drive to support and increase the user group community however and launched an official hub for their rapidly growing number of user groups. They also provided the ColdFusion Evangelist Kit (mentioned above) to help every community member become a better evangelist. +1 to Adobe.

And what’s your challenge for 2009?

Same as 2008 - convert a non-CF developer to CF. Just one. C’mon, you have 349 days left. If all of you - all 500,000 of you - convert just one developer this year, we’ll double the community. You believe in ColdFusion - make someone else believe in it too!

This Article Written by :- Sean Corfield

About The Author
Sean is currently Chief Technology Officer for Railo Technologies US. He has worked in IT for over twenty five years, starting out writing database systems and compilers then moving into mobile telecoms and finally into web development in 1997. Along the way, he worked on the ISO and ANSI C++ Standards committees for eight years and is a staunch advocate of software standards and best practice. Sean has championed and contributed to a number of CFML frameworks and was lead developer on Fusebox for two years.


More Information visit ColdFusion Development.

Cold Fusion was created as a commercial product by the Allaire Corporation. As a commercial product it has some features different from other Server Side Scripting Languages. The first major difference is that Cold Fusion scripts do not have to display their source code like every other scripting language, it is possible to run encrypted versions of the scripts.

This allows for individuals to sell their own scripts without fear of piracy, however it has the side effect of stemming the flow of free open source CF scripts for use by the learning webmaster.

The second major difference is that Cold Fusion costs money. A server side scripting language works with an interpreter. Depending on the extension of the filename to be served, .php .asp or .cfm, the server will first send the file to an interpreter which is what dynamically generates your page. So to use these languages you need to install them on your server.

PHP is free, ASP is free, but CF costs money, and that may be the reason why it is growing only slowly. However most NT hosting packages do already include Cold Fusion so for the person who does not own their own server this pricing difference will not have much affect.

As to the language itself, I have worked with both ASP and PHP before and it is my opinion that Cold Fusion is the easiest to learn and use.

Read More : http://www.sitepoint.com/article/cold-fusion-tutorial/


More Information visit ColdFusion Application Development.