|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).
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...
Sep. 26, 2016 05:15 PM EDT Reads: 231
Vidyo, Inc., has joined the Alliance for Open Media. The Alliance for Open Media is a non-profit organization working to define and develop media technologies that address the need for an open standard for video compression and delivery over the web. As a member of the Alliance, Vidyo will collaborate with industry leaders in pursuit of an open and royalty-free AOMedia Video codec, AV1. Vidyo’s contributions to the organization will bring to bear its long history of expertise in codec technolo...
Sep. 26, 2016 05:15 PM EDT Reads: 2,571
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
Sep. 26, 2016 05:00 PM EDT Reads: 2,714
If you’re responsible for an application that depends on the data or functionality of various IoT endpoints – either sensors or devices – your brand reputation depends on the security, reliability, and compliance of its many integrated parts. If your application fails to deliver the expected business results, your customers and partners won't care if that failure stems from the code you developed or from a component that you integrated. What can you do to ensure that the endpoints work as expect...
Sep. 26, 2016 04:30 PM EDT Reads: 1,614
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life sett...
Sep. 26, 2016 04:30 PM EDT Reads: 3,343
The Transparent Cloud-computing Consortium (abbreviation: T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data processing High speed and high quality networks, and dramatic improvements in computer processing capabilities, have greatly changed the nature of applications and made the storing and processing of data on the network commonplace.
Sep. 26, 2016 04:15 PM EDT Reads: 1,019
SYS-CON Events announced today that ReadyTalk, a leading provider of online conferencing and webinar services, has been named Vendor Presentation Sponsor at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. ReadyTalk delivers audio and web conferencing services that inspire collaboration and enable the Future of Work for today’s increasingly digital and mobile workforce. By combining intuitive, innovative tec...
Sep. 26, 2016 04:00 PM EDT Reads: 2,836
Cognitive Computing is becoming the foundation for a new generation of solutions that have the potential to transform business. Unlike traditional approaches to building solutions, a cognitive computing approach allows the data to help determine the way applications are designed. This contrasts with conventional software development that begins with defining logic based on the current way a business operates. In her session at 18th Cloud Expo, Judith S. Hurwitz, President and CEO of Hurwitz & ...
Sep. 26, 2016 03:45 PM EDT Reads: 2,902
The vision of a connected smart home is becoming reality with the application of integrated wireless technologies in devices and appliances. The use of standardized and TCP/IP networked wireless technologies in line-powered and battery operated sensors and controls has led to the adoption of radios in the 2.4GHz band, including Wi-Fi, BT/BLE and 802.15.4 applied ZigBee and Thread. This is driving the need for robust wireless coexistence for multiple radios to ensure throughput performance and th...
Sep. 26, 2016 03:30 PM EDT Reads: 1,555
Enterprise IT has been in the era of Hybrid Cloud for some time now. But it seems most conversations about Hybrid are focused on integrating AWS, Microsoft Azure, or Google ECM into existing on-premises systems. Where is all the Private Cloud? What do technology providers need to do to make their offerings more compelling? How should enterprise IT executives and buyers define their focus, needs, and roadmap, and communicate that clearly to the providers?
Sep. 26, 2016 03:00 PM EDT Reads: 1,552
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management solutions, helping companies worldwide activate their data to drive more value and business insight and to transform moder...
Sep. 26, 2016 02:45 PM EDT Reads: 2,612
Fifty billion connected devices and still no winning protocols standards. HTTP, WebSockets, MQTT, and CoAP seem to be leading in the IoT protocol race at the moment but many more protocols are getting introduced on a regular basis. Each protocol has its pros and cons depending on the nature of the communications. Does there really need to be only one protocol to rule them all? Of course not. In his session at @ThingsExpo, Chris Matthieu, co-founder and CTO of Octoblu, walk you through how Oct...
Sep. 26, 2016 02:15 PM EDT Reads: 2,108
The Internet of Things can drive efficiency for airlines and airports. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Sudip Majumder, senior director of development at Oracle, will discuss the technical details of the connected airline baggage and related social media solutions. These IoT applications will enhance travelers' journey experience and drive efficiency for the airlines and the airports. The session will include a working demo and a technical d...
Sep. 26, 2016 02:00 PM EDT Reads: 1,716
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
Sep. 26, 2016 01:45 PM EDT Reads: 2,572
Digital innovation is the next big wave of business transformation based on digital technologies of which IoT and Big Data are key components, For example: Business boundary innovation is a challenge to excavate third-party business value using IoT and BigData, like Nest Business structure innovation may propose re-building business structure from scratch, as Uber does in the taxicab industry The social model innovation is also a big challenge to the new social architecture with the design fr...
Sep. 26, 2016 01:30 PM EDT Reads: 1,172
The many IoT deployments around the world are busy integrating smart devices and sensors into their enterprise IT infrastructures. Yet all of this technology – and there are an amazing number of choices – is of no use without the software to gather, communicate, and analyze the new data flows. Without software, there is no IT. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the protocols that communicate data and the emerging data analy...
Sep. 26, 2016 01:00 PM EDT Reads: 1,631
DevOps at Cloud Expo, taking place Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long dev...
Sep. 26, 2016 12:45 PM EDT Reads: 3,426
SYS-CON Events announced today that China Unicom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. China United Network Communications Group Co. Ltd ("China Unicom") was officially established in 2009 on the basis of the merger of former China Netcom and former China Unicom. China Unicom mainly operates a full range of telecommunications services including mobile broadband (GSM, WCDMA, LTE F...
Sep. 26, 2016 12:45 PM EDT Reads: 1,743
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at EMC, will introduce a methodology for capturing, enriching and sharing data (and analytics) across the organizati...
Sep. 26, 2016 12:15 PM EDT Reads: 1,677
SYS-CON Events announced today the Enterprise IoT Bootcamp, being held November 1-2, 2016, in conjunction with 19th Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA. Combined with real-world scenarios and use cases, the Enterprise IoT Bootcamp is not just based on presentations but with hands-on demos and detailed walkthroughs. We will introduce you to a variety of real world use cases prototyped using Arduino, Raspberry Pi, BeagleBone, Spark, and Intel Edison. Y...
Sep. 26, 2016 11:15 AM EDT Reads: 2,881