Welcome!

You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

Frameworks, Frameworks, Frameworks

Why you should use a framework - Part 1

Your boss tells you that he wants you to build a ColdFusion application based on his requirements, which will take you about a month to complete. You are now faced with two options, you can either start coding your application in spaghetti code fashion, or you can explore the many frameworks ColdFusion offers and choose one of them.

Writing spaghetti code for many is an easy solution, by approaching the application development with a top-to-bottom declaration of code. Using the spaghetti code method will seem logical at first but you'll soon realize that there's so much code you'll be lost debugging the program for months. A framework for ColdFusion is just like books with a table of contents at the front and an index at the back. Because this pattern is always used, anyone who uses the book knows how to access information they need from that book, so frameworks have the same pattern for universal use. Using a framework(s) is the way to go because it will cut your development time, give you better productivity as well as increased code reusability, and help you organize your code and make it easier for future enhancements.

There is nevertheless a lot of contradiction as to whether frameworks are needed. The main argument on the flip side of the coin is that the learning curve for any frameworks is steep. Well, there is quite a challenge, but if you're going to build something sophisticated in the first place then this learning curve is no challenge to you at all. Another reason why this learning curve is worth the turn is because if you don't use a framework in the long run the code might get so unmanageable that you'll have no choice but to start from scratch, wasting valuable time and in most cases money. Another well-known argument is that frameworks are for beginners who want to use the RAD methodology of development. This, however, isn't true, because it's a well-known fact that all the big software development firms use frameworks when developing applications. There are many famous frameworks such as the .NET framework for the Win32 and Win64 platforms, and in terms of Web application frameworks there are numerous frameworks that are used by major Web sites such frameworks Coldbox, Fusebox, and Mach II. All in all, yes, there's quite a learning curve, but accepting the challenge will make your life much easier and keep your code managed and clean.

All developers know that time is always against them. A deadline is always looming over a developer's head and he or she is always in a rush to complete the application's lifecycle. It's not that the developer can't write code quickly, it's that once the code is written, debugging takes a much more time. By using an application framework, you'll have enough time to develop an entire operating system. An application framework is a predefined structure that will help you organize your application by using various object-oriented programming methodologies. Another reason why your development time will be reduced is that in almost every framework there's a set of predefined "solutions" that you can use to unravel a lot of the problems you might encounter during development. A good example of a framework that has predefined solutions is the Fusebox framework in which you simply tell the circuit.xml file when and what you want to load and it'll do the processing and code generation without any errors.

Another great motive for using an application framework is that you won't have to do repetitive tasks over and over again. For example, if you wanted every page on your site to check if the user is logged in, and you have well over a thousand pages of information the non-framework way of doing it will be to open each page and add a isDefined(Session.user) function to do the validation. However. what if you change the session variable to something other than user, you'll have to open thousands of pages again to change that variable. Using this approach will cost a lot of time and valuable resources. On the other hand, if you used a framework, you could have defined that on each page-request executing the function isDefined(Session.user) and later on if you were to change the session variable, you could easily change just one line of code in your application framework and it would do the job for you.

Better productivity is what every software developer wants and by using an application framework you'll get just that. In general, most application frameworks use object-oriented programming methodologies, which give you a lot of code reusability that in turn give you better productivity. For instance, if you were to create a class or cfc component (in this case) of all the items your authentication system does in your application then by using a framework like MACH II or even designing your own proprietary framework you can call the functions in those classes numerous times without having to write the code that many times.

The basic ColdFusion application framework that many like to call the Application.cfc framework is an example of how a framework can lead to better productivity. There are several solutions built into the framework that help you reuse your code. One useful method is the OnError, which is called whenever there's an error on your cfm page. In between this method you can declare some code such as <cfinclude template='error.cfm'/>, which tells the user to contact you in case of an error and every time an error occurs your code will be executed. This is a good example of code reusability because you don't have to go through all your pages and error check; instead by using that method the framework will do it for you. Also, some developers who are looking to use their time well can rest assured that all of these frameworks are simple to install, simple to use, and simple to deploy. To get any of these frameworks running, all you have to do is create a ColdFusion mapping to the core framework files and then use the framework skeleton application to develop on it. In sum, you'll have a much more productive environment and achieve a higher rate of code reusability.

Another reason to consider using a framework is that over time your code will grow, with all the patches and maintenance you make to it, and if you're using the spaghetti code method your code will look like it's been encrypted using AES. So rather than letting that unfortunate event occur, using a framework will help organize and maintain your code. An example would be using a framework such as Fusebox 5.1 and its MVC architecture to organize your code. Using an MVC architecture helps separate your code logic tier from your presentation tier and by doing this if you ever have to make modifications you can rest assured that it will have no visual impact on your presentation tier and vice versa. If you were to compare spaghetti code style to MVC-type architecture, you'll clearly see why life is easier on the MVC side. A framework will also increase code readability by organizing the code in a human-readable logical way, an example would be the Coldbox framework, which has a framework dashboard used to organize all your configurations of the application, so instead of digging deep into the code, you can easily configure your framework and application with a simple dashboard. Another great framework that you can use for a simple MVC-type architecture is MACH II in which you'll be able to develop applications faster than MACH II. What a fun framework. Generally speaking, a framework is a really good way to keeping all your code organized and will help you a lot when it comes to updating and adding new features in your code over the course of the application lifecycle.

All in all, using a framework can help increase code reliability by minimizing errors, increase productivity, and maintain your code through out the application lifecycle. As you can clearly see, these give you a significant advantage over the old spaghetti code method and learning how to use a framework can and will give you a good asset in your skill set. Many large corporations are looking for people skilled in many of the top application frameworks such as Fusebox and MACH II. Overall, after using a framework you'll wonder how you ever developed applications without it..

More Stories By Faisal Abid

Faisal Abid is a third-year student at West Hill CI and loves Flex, ColdFusion, and rich Internet applications. He is also the founder and owner of G-uniX Technologies (www.G-uniX.com), an RIA software development consultancy based in Toronto that specializes in Flex 2 and ColdFusion applications. He has a blog at blog.G-uniX.com that he updates bi-weekly with G-uniX news, Flex tutorials, ColdFusion tutorials, and Spry tutorials.

Comments (1)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the University of Cambridge, Darktrace's Enterprise Immune System is the first non-consumer application of machine learning to work at scale, across all network types, from physical, virtualized, and cloud, through to IoT and industrial control systems. Installed as a self-configuring cyber defense platform, Darktrace continuously learns what is ‘normal' for all devices and users, updating its understa...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Apptio fuels digital business transformation. Technology leaders use Apptio's machine learning to analyze and plan their technology spend so they can invest in products that increase the speed of business and deliver innovation. With Apptio, they translate raw costs, utilization, and billing data into business-centric views that help their organization optimize spending, plan strategically, and drive digital strategy that funds growth of the business. Technology leaders can gather instant recomm...
OpsRamp is an enterprise IT operation platform provided by US-based OpsRamp, Inc. It provides SaaS services through support for increasingly complex cloud and hybrid computing environments from system operation to service management. The OpsRamp platform is a SaaS-based, multi-tenant solution that enables enterprise IT organizations and cloud service providers like JBS the flexibility and control they need to manage and monitor today's hybrid, multi-cloud infrastructure, applications, and wor...
The Master of Science in Artificial Intelligence (MSAI) provides a comprehensive framework of theory and practice in the emerging field of AI. The program delivers the foundational knowledge needed to explore both key contextual areas and complex technical applications of AI systems. Curriculum incorporates elements of data science, robotics, and machine learning-enabling you to pursue a holistic and interdisciplinary course of study while preparing for a position in AI research, operations, ...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and Bi...
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get tailored market studies; and more.
Tapping into blockchain revolution early enough translates into a substantial business competitiveness advantage. Codete comprehensively develops custom, blockchain-based business solutions, founded on the most advanced cryptographic innovations, and striking a balance point between complexity of the technologies used in quickly-changing stack building, business impact, and cost-effectiveness. Codete researches and provides business consultancy in the field of single most thrilling innovative te...
CloudEXPO has been the M&A capital for Cloud companies for more than a decade with memorable acquisition news stories which came out of CloudEXPO expo floor. DevOpsSUMMIT New York faculty member Greg Bledsoe shared his views on IBM's Red Hat acquisition live from NASDAQ floor. Acquisition news was announced during CloudEXPO New York which took place November 12-13, 2019 in New York City.