|By Ben Forta||
|November 11, 2003 10:57 AM EST||
It's been about seven years since I first inscribed my "10 Commandments of ColdFusion Development" for my first ColdFusion book, and four years since they were last revised (yes, my Ten Commandments are not as omnipresent as their more famous namesake). ColdFusion has changed much over this time, as have the applications we're building and how we build them. And so this month, in honor of MAX, I present to you "The Newer and Even More Improved Ten Commandments of ColdFusion Development," or to adhere to Macromedia nomenclature, "The Ten Commandments 2004."
Have a Plan
We've all done it, and probably more than once. ColdFusion makes it so easy to start coding that there is often the temptation to start projects by firing up an editor and creating CFM files. That's a bad thing indeed. Nothing is more harmful to your development efforts than failing to plan properly, and you should be spending more time planning than coding, not less.
Planning involves thinking through every aspect of your application, from database design to UI considerations, from resource management to schedules and deliverables, and from feature lists with implementation details to language and presentation. You'd never build a house without detailed blueprints (well, you might try, but you'd never get the necessary permission to begin work), and building an application is no different.
I am constantly amazed by the number of applications that I am asked to look at that have no supporting documentation. And not just small development shops - I'm talking about some of the largest and most respected corporations too. Scalability problems? I wouldn't doubt it. I'd actually be amazed if such an app ever did scale. You cannot expect an application that grew to scale in spite of its developers. Nor can you expect it to be bug-free, manageable, or delivered on time.
Of course, some clients just want the job done. Competition may require that you cut corners or lose the deal, and planning always seems like the logical place to cut. So what to do? You may opt to do as requested, recognizing that you'll probably end up with a dissatisfied client, and will thus be creating more work for yourself (or someone else) in the long term. Or you may opt to walk away (idealistic, and perhaps not always realistic). It's a tough call, but whatever you do, make sure that the client is fully aware of the implications of the demands and decisions made (and be sure to get clients to sign off on exactly what they want so as to protect yourself in the future).
Organize Your Application
An extension of planning your application is organizing it (along with any other applications). Applications are made up of lots of little bits and pieces, and keeping them organized is imperative.
This includes directory structures and determining where common files should go, moving images to their own directory (or server), breaking long files into smaller, more manageable (and more reusable) ones, and even ensuring consistent organization among different applications.
The intent here is to make it easier for you (and the lucky soul who inherits the project) to locate code, isolate problems, reuse development, be able to replace or update components without risking breaking things...you get the idea. Understanding application design should not require perusing extensive code listings to understand code blocks and their relationship to each other; application organization must be logical and clear and ideally intuitive too. Going back to the prior Commandment, "Have a Plan," all organization should be documented in detail as part of that plan.
Set Coding Standards
This is an interesting one, and one I get asked about often. Macromedia has not published formal recommendations on coding standards, nor in my opinion should they. Macromedia's job is to create killer tools and products for us developers; our job is to use them as works best for us. I don't believe that a single set of coding standards would work for all developers, but at the same time, I don't believe any developer should be writing code that does not adhere to a standard - any standard.
Coding standards include everything from file- and directory-naming conventions, to variable naming conventions, to code organization and ordering within your source code, to error-handling, to componentization, and much more. (For example, if all variables that tain dates begin with "dt", then references to a variable named "dtOrderDate" become very selfexplanatory.)
The purpose of coding standards is to ensure some level of consistency in your code. Whether it is to allow other developers to be able to understand and work with your code, or whether it is simply so that you'll know what the heck you did (and why) six months down the line, coding standards provide a mechanism to create code that describes and explains itself.
There is no right or wrong coding standard as long as it is used. The only thing wrong about coding standards is not using one. (Note: To get you started, you may want to take a look at Sean Corfield's Coding Guidelines at www.corfield.org/coldfusion/coding_standards/.)
An extension of this is the use of application methodologies and architectures. The purpose of these is to encourage good design and the use of best practices. I am not going to comment on the virtues or failings of specific methodologies or architectures; there is no right or wrong here either.
Don't be swayed by hype and trends and acronyms. What is right for someone else may not be right for you, and what is right for one of your applications may not be right for all your applications. Any architecture should help you write better code. If you find one that works for you, great; if not, come up with something yourself, or adapt something you find. Either way, just do it.
Comment Your Code
This is an obvious one, but apparently few of us have the time to pay attention to the obvious. So, I'll say it once again, all code must be commented. (For the record, I'd fire an employee on the spot for turning in code that is not commented, that's how serious a sin I believe this one to be.)
Every source code file needs a descriptive header containing a description, the author info, creation date, chronological list of changes, any dependencies and assumptions, and any other relevant information. In addition, every conditional statement, every loop, every set of variable assignments, and every include or component reference must be commented with a simple statement explaining what is being done, and why.
It's a pain, I know. But the next time you (or anyone else) has to work with the code you'll appreciate the effort immeasurably. And you might even be able to safely make code changes without breaking things in the process.
Functionality First, Then Features
Yet another obvious one, and a common beginner's mistake. Yes, creating whiz-bang UI effects may be far more fun that writing business rules and dataentry validation routines, but the latter are far more important to the success of your application. Concentrate on creating a complete working application, then pretty it up as needed.
But at the same time, don't neglect the user experience. Some of the best applications ever created failed (and continue to fail) because they were a pain to use. While it is a mistake to start with menus and color choices and application screen flow, it is an even bigger mistake to fail to leave adequate time for these.
It's about sequencing and balancing. Do so and increase the chance that you'll finish on schedule for a change. The final result might not be as cool as you'd like, but there is something to be said for an application that actually works, even an uncool looking one. Furthermore, (as explained in the next Commandment) it is very difficult to debug logic problems when the code is cluttered with fancy formatting and features.
Build and Test Incrementally
You'd be amazed (or maybe you wouldn't be) by the number of e-mail messages I get asking me to help debug attached files - attached files with hundreds of lines of code, often more, and often multiple files all needed to make the application work. My standard response to these messages is "Yes, I'll help you debug your code, but first narrow it down to just the few lines in question." Not surprisingly, many developers find that the process of narrowing down the problems allows them to diagnose their code themselves.
Being sent the messages and requests isn't what bothers me (I know I am going to regret saying this, but I really do not mind those at all). What really bothers me is that what becomes apparent is that core code was never tested in isolation. This goes back to the prior Commandment, "Functionality First, Then Features." And the same is true for testing.
When you develop core components of your application, test them. Write little test routines, hard code, or smoke and mirrors as necessary, but however you do it, do it. Obviously you'll have to test your complete application when done, and some problems won't come to light until then, but the more you can test code blocks in isolation, the better.
Never Reinvent the Wheel, and Plan Not To
This is one I have written about extensively, especially in this column. Write code with reuse in mind, and reuse code whenever possible. When designing your code, put the extra time in up front to make sure it is not hard-coded or highly task-specific unless it absolutely has to be. Make sure code can stand on its own two feet whenever possible, never make unnecessary assumptions about where code is being used and how, and never reference explicit scopes or variables outside of your own code.
The benefits? Being able to reuse existing code will shorten your development time. You'll also stand a far greater chance of creating bug-free code when you use components that have already been used and tested. Plus, if you do make subsequent fixes and corrections, all code that uses the improved components benefit.
ColdFusion developers have lots of reuse options, and should pay particular attention to ColdFusion Components (introduced in detail in a two-part column in CFDJ, Volume 4, issues 6 and 7), which both help and encourage tiered application design (see CFDJ, Volume 3, issue 8, and Volume 4, issue 10), code reuse, and all-around better coding.
Lots of benefits, and no downside whatsoever. Should be a no-brainer. Enough said.
Use All the Tools at Your Disposal, Not Just ColdFusion
This is an extension of the previous commandment, and another one I have written about before (see CFDJ, Volume 1, issue 3, "Take Your Database Out of Retirement," and CFDJ, Volume 2, issue 3, "When NOT to Use ColdFusion"). Unlike all the other Commandments in this list, this one is more ColdFusion specific.
ColdFusion applications are usually not standalone entities. They rely on database servers, mail servers, and much more. In addition, ColdFusion can leverage Java, Web services, COM, CORBA, and C/C++ code. Use these tools, as many as needed, and always attempt to pick the best one for a specific job. The best ColdFusion applications are not the ones written purely in ColdFusion, but the ones that leverage the best technologies for the job, all held together by ColdFusion. And the worst ColdFusion applications are the ones that try to go it solo.
The truth is, even beyond your ColdFusion application development, if you are serious about application development and a future in this industry, then it's in your best interest to not be a one-trick pony. Diversifying your skills will make you a better and more valuable developer, and will also improve your ColdFusion applications in the short term.
Respect (and Fear) Production Servers
There are two very different aspects to this one.
The first is obvious, or so you'd think. But any time I bring this up in front of a group of CF developers, the grins, sheepish looks, and knowing glances convince me that there are transgressors in our midst.
All development and testing must occur on servers established for just that purpose. Yes, this means you'll need additional hardware or the installation of ColdFusion Enterprise (so as to have multiple instances of ColdFusion to work with), but the extra cost is nothing compared to the cost of bringing down your application because that little change was not as little as you expected.
Write your code, test it, debug it as needed, deploy it to a testing server, test it some more and some more, and then finally, deploy it to your live production server. And don't repeat this process too often. Instead of uploading slightly changed versions of your application every day, collect the changes, test them some more, and deploy them monthly or weekly, or whenever works best for you.
That's the respect part. As for fear, production servers are vulnerable, they are necessarily publicly visible, and they are necessarily used and accessed by all sorts of people (including many of whom you may otherwise choose to have nothing to do with).
A little paranoia is healthy when it comes to public-facing servers. Assume that your server will be compromised, and that whatever is on it (and whatever it has access to) will be stolen or tampered with at some point. This has very practical implications - from never embedding passwords in source code, to not keeping databases on your Web server, to not using accounts with access to lots of other resources.
I'll state it again, just to be perfectly clear about this: anything that is on your server, and anything that your server has access to, will be stolen or compromised at some point. Be frightened, be very frightened. And once you have come to grips with your fear, be mindful and cautious.
The key here is that your production server is sacred. Don't touch it at all unless you have to (and the less frequently the better), and never, ever, make changes on it, even minor ones. In addition, don't leave your valuables exposed, or put differently, put nothing on your server that you'd not want in the hands of others.
Keep Things Simple
Simplicity is a good thing, complexity usually isn't. This affects everything from user interfaces to database schemas to documentation to application architecture. Keep it simple. This has obvious implications for user interfaces, application flow, data-entry screens, and error messages. But it goes way beyond these too.
At the risk of upsetting hardcore extremists, this is even true of application architecture and methodologies. I have seen relatively simple apps (apps that should have taken days to develop) turn into behemoth projects because of an insistence that everything be an MVC application. Not that I have anything against MVC, but we don't live in a one-size-fits-all world. If a simpler design is effective, that may be good enough.
Similarly, while it would be wonderful to be able to clearly articulate a blackand- white distinction of what should be written in ColdFusion and what should be written in Java, the reality is that there are shades of gray. Sometimes the less pure solution may be the simpler one. There is no right or wrong here, but there is a lot to be said for simplicity.
There you have it - my new, and greatly improved, Ten Commandments of ColdFusion Development. Of course, you may completely disagree with my list, in which case I'd love to hear what you'd change, and why.
Good luck with your coding, and I look forward to meeting you in person at MAX in Salt Lake City, UT (November 18-21).
SYS-CON Events announced today that HPM Networks will exhibit at the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. For 20 years, HPM Networks has been integrating technology solutions that solve complex business challenges. HPM Networks has designed solutions for both SMB and enterprise customers throughout the San Francisco Bay Area.
Aug. 2, 2015 05:45 PM EDT Reads: 512
For IoT to grow as quickly as analyst firms’ project, a lot is going to fall on developers to quickly bring applications to market. But the lack of a standard development platform threatens to slow growth and make application development more time consuming and costly, much like we’ve seen in the mobile space. In his session at @ThingsExpo, Mike Weiner, Product Manager of the Omega DevCloud with KORE Telematics Inc., discussed the evolving requirements for developers as IoT matures and conducted a live demonstration of how quickly application development can happen when the need to comply wit...
Aug. 2, 2015 11:15 AM EDT Reads: 356
The Internet of Everything (IoE) brings together people, process, data and things to make networked connections more relevant and valuable than ever before – transforming information into knowledge and knowledge into wisdom. IoE creates new capabilities, richer experiences, and unprecedented opportunities to improve business and government operations, decision making and mission support capabilities.
Aug. 1, 2015 10:00 AM EDT Reads: 339
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at @ThingsExpo, James Kirkland, Red Hat's Chief Architect for the Internet of Things and Intelligent Systems, described how to revolutionize your archit...
Jul. 30, 2015 07:30 PM EDT Reads: 1,422
MuleSoft has announced the findings of its 2015 Connectivity Benchmark Report on the adoption and business impact of APIs. The findings suggest traditional businesses are quickly evolving into "composable enterprises" built out of hundreds of connected software services, applications and devices. Most are embracing the Internet of Things (IoT) and microservices technologies like Docker. A majority are integrating wearables, like smart watches, and more than half plan to generate revenue with APIs within the next year.
Jul. 30, 2015 02:30 PM EDT Reads: 141
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it! In her Opening Keynote at 16th Cloud Expo, Sandy Carter, IBM General Manager Cloud Ecosystem and Developers, and a Social Business Evangelist, d...
Jul. 30, 2015 12:00 PM EDT Reads: 2,082
In his keynote at 16th Cloud Expo, Rodney Rogers, CEO of Virtustream, discussed the evolution of the company from inception to its recent acquisition by EMC – including personal insights, lessons learned (and some WTF moments) along the way. Learn how Virtustream’s unique approach of combining the economics and elasticity of the consumer cloud model with proper performance, application automation and security into a platform became a breakout success with enterprise customers and a natural fit for the EMC Federation.
Jul. 30, 2015 09:00 AM EDT Reads: 2,174
The Internet of Things is not only adding billions of sensors and billions of terabytes to the Internet. It is also forcing a fundamental change in the way we envision Information Technology. For the first time, more data is being created by devices at the edge of the Internet rather than from centralized systems. What does this mean for today's IT professional? In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists addressed this very serious issue of profound change in the industry.
Jul. 29, 2015 03:00 PM EDT Reads: 1,299
Discussions about cloud computing are evolving into discussions about enterprise IT in general. As enterprises increasingly migrate toward their own unique clouds, new issues such as the use of containers and microservices emerge to keep things interesting. In this Power Panel at 16th Cloud Expo, moderated by Conference Chair Roger Strukhoff, panelists addressed the state of cloud computing today, and what enterprise IT professionals need to know about how the latest topics and trends affect their organization.
Jul. 29, 2015 02:00 PM EDT Reads: 1,207
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society-changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his session at @ThingsExpo, Jason Mondanaro, Director, Product Management at Metanga, discussed how you can plan to cooperate, partner, and form lasting all-star teams to change the world and it starts with business models and monetization strategies.
Jul. 28, 2015 04:30 PM EDT Reads: 1,776
Converging digital disruptions is creating a major sea change - Cisco calls this the Internet of Everything (IoE). IoE is the network connection of People, Process, Data and Things, fueled by Cloud, Mobile, Social, Analytics and Security, and it represents a $19Trillion value-at-stake over the next 10 years. In her keynote at @ThingsExpo, Manjula Talreja, VP of Cisco Consulting Services, discussed IoE and the enormous opportunities it provides to public and private firms alike. She will share what businesses must do to thrive in the IoE economy, citing examples from several industry sectors.
Jul. 28, 2015 11:00 AM EDT Reads: 2,049
There will be 150 billion connected devices by 2020. New digital businesses have already disrupted value chains across every industry. APIs are at the center of the digital business. You need to understand what assets you have that can be exposed digitally, what their digital value chain is, and how to create an effective business model around that value chain to compete in this economy. No enterprise can be complacent and not engage in the digital economy. Learn how to be the disruptor and not the disruptee.
Jul. 27, 2015 10:00 AM EDT Reads: 2,045
Akana has released Envision, an enhanced API analytics platform that helps enterprises mine critical insights across their digital eco-systems, understand their customers and partners and offer value-added personalized services. “In today’s digital economy, data-driven insights are proving to be a key differentiator for businesses. Understanding the data that is being tunneled through their APIs and how it can be used to optimize their business and operations is of paramount importance,” said Alistair Farquharson, CTO of Akana.
Jul. 27, 2015 09:00 AM EDT Reads: 336
Business as usual for IT is evolving into a "Make or Buy" decision on a service-by-service conversation with input from the LOBs. How does your organization move forward with cloud? In his general session at 16th Cloud Expo, Paul Maravei, Regional Sales Manager, Hybrid Cloud and Managed Services at Cisco, discusses how Cisco and its partners offer a market-leading portfolio and ecosystem of cloud infrastructure and application services that allow you to uniquely and securely combine cloud business applications and services across multiple cloud delivery models.
Jul. 27, 2015 08:00 AM EDT Reads: 1,911
The enterprise market will drive IoT device adoption over the next five years. In his session at @ThingsExpo, John Greenough, an analyst at BI Intelligence, division of Business Insider, analyzed how companies will adopt IoT products and the associated cost of adopting those products. John Greenough is the lead analyst covering the Internet of Things for BI Intelligence- Business Insider’s paid research service. Numerous IoT companies have cited his analysis of the IoT. Prior to joining BI Intelligence, he worked analyzing bank technology for Corporate Insight and The Clearing House Payment...
Jul. 26, 2015 09:00 PM EDT Reads: 1,588
"Optimal Design is a technology integration and product development firm that specializes in connecting devices to the cloud," stated Joe Wascow, Co-Founder & CMO of Optimal Design, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
Jul. 25, 2015 02:00 PM EDT Reads: 405
SYS-CON Events announced today that CommVault has been named “Bronze Sponsor” of SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. A singular vision – a belief in a better way to address current and future data management needs – guides CommVault in the development of Singular Information Management® solutions for high-performance data protection, universal availability and simplified management of data on complex storage networks. CommVault's exclusive single-platform architecture gives companies unp...
Jul. 25, 2015 01:00 PM EDT Reads: 1,975
Electric Cloud and Arynga have announced a product integration partnership that will bring Continuous Delivery solutions to the automotive Internet-of-Things (IoT) market. The joint solution will help automotive manufacturers, OEMs and system integrators adopt DevOps automation and Continuous Delivery practices that reduce software build and release cycle times within the complex and specific parameters of embedded and IoT software systems.
Jul. 25, 2015 12:15 PM EDT Reads: 486
"ciqada is a combined platform of hardware modules and server products that lets people take their existing devices or new devices and lets them be accessible over the Internet for their users," noted Geoff Engelstein of ciqada, a division of Mars International, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
Jul. 25, 2015 12:00 PM EDT Reads: 1,555
Internet of Things is moving from being a hype to a reality. Experts estimate that internet connected cars will grow to 152 million, while over 100 million internet connected wireless light bulbs and lamps will be operational by 2020. These and many other intriguing statistics highlight the importance of Internet powered devices and how market penetration is going to multiply many times over in the next few years.
Jul. 25, 2015 09:00 AM EDT Reads: 1,503