Be the first to write a review
ColdFusion MX: Reusing Code
In the last two articles (ColdFusion MX Installation & Basic Testing and ColdFusion MX: Displaying Database Data) we did a lot of setup for our working environment, and we were able to retrieve records from a MySQL database to display on the screen. At this point when you’re ready to start writing more code, it’s a good time to learn about code re-use in ColdFusion MX.
The basic mantra of all developers is “write it once, use it many times”. There are many reasons why we try to reuse the code we write such as lower maintenance, site/application consistent look and feel and even a layer of abstraction where we can separate our business logic of our application from the user interface.
ColdFusion MX gives us several devices for reusing code. In this article, I’d like to touch on all of the code reuse tools that are available to us.
In this article, we’re going to work with ColdFusion MX and explore the following tasks:
· The <cfinclude> tag
· ColdFusion Mappings
· Custom Tags
· User-Defined Functions
· ColdFusion Components (CFCs)
· Code reuse best practices
These are the basic tools available to us for code reuse in ColdFusion MX. Often times, we use these tools to help us with our application architecture. Much can be written on any one of these topics and here I’d like to give good introductory examples on each so you can begin using them right away in your applications.
Rob Sherman
Rob Sherman Bio:
Attended Fullerton College for a BS in Computer Science and began designing web pages in 1991. In 1994 he began working for an Internet Service Provider called Compulearn in Tarzana, CA. While there he began teaching various computer classes like Access, Word, Excel and Internet related courses. Aside from teaching he became the Webmaster for Compulearn and started designing website for Compulearn and it’s clients. Some of those clients included: Arco, Gilette, Vision Correction Centers, various legal and insurance offices, AT & T, San Fernando Valley Bar Association, a teen website called Moxiegirl, State of Arizona, and the United States Commerce Department.
Rob also decided to take on other responsibilities and worked for a non-profit organization called the Global Schoolhouse Foundation in 1997. This non-profit organization had a mission of bringing Internet technology into the classrooms for both students and teachers. The work this foundation performed was even recognized by now presidential candidate Al Gore, and more recently President George W. Bush and met with the organization periodically. Rob excelled in the ColdFusion language and was building web based projects that brought teachers and students together from over 30 countries.
In 1999, Rob left the Global Schoolhouse to take on the title of Director of Development for an online auction website located in Paris, France. This website was Eurobid.com. In February of 1999 the idea of a truly multi-lingual auction website for the European community was just a thought, but by the end of that same year it became a reality. While continuing to work from the states, Rob put together a team of ColdFusion developers across the U.S. as well as system administrators and was responsible for architecting one of the strongest auction communities in all Europe.
After leaving Eurobid in 2000, Rob formed his own consulting corporation, known as CFDude, Inc. and maintains several clients. He also became a Macromedia Certified Instructor (along with Macromedia Advanced Certified ColdFusion Developer) teaching courses for Andrew’s Technology all over the U.S. and later taught ColdFusion MX and Flash MX 2004 classes for RoundPeg. Rob was also selected to be a part of the pilot program for the Macromedia Certified Professional Program and is one of the first Macromedia Certified Professionals. Rob presently holds the following certifications: Advanced ColdFusion Developer/Trainer; Flash MX Developer/Trainer; Flash MX 2004 Developer/Trainer.