|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).
There are several IoTs: the Industrial Internet, Consumer Wearables, Wearables and Healthcare, Supply Chains, and the movement toward Smart Grids, Cities, Regions, and Nations. There are competing communications standards every step of the way, a bewildering array of sensors and devices, and an entire world of competing data analytics platforms. To some this appears to be chaos. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, Bradley Holt, Developer Advocate a...
Jun. 27, 2016 12:00 PM EDT Reads: 756
Presidio has received the 2015 EMC Partner Services Quality Award from EMC Corporation for achieving outstanding service excellence and customer satisfaction as measured by the EMC Partner Services Quality (PSQ) program. Presidio was also honored as the 2015 EMC Americas Marketing Excellence Partner of the Year and 2015 Mid-Market East Partner of the Year. The EMC PSQ program is a project-specific survey program designed for partners with Service Partner designations to solicit customer feedbac...
Jun. 27, 2016 11:55 AM EDT Reads: 141
Connected devices and the industrial internet are growing exponentially every year with Cisco expecting 50 billion devices to be in operation by 2020. In this period of growth, location-based insights are becoming invaluable to many businesses as they adopt new connected technologies. Knowing when and where these devices connect from is critical for a number of scenarios in supply chain management, disaster management, emergency response, M2M, location marketing and more. In his session at @Th...
Jun. 27, 2016 10:00 AM EDT Reads: 998
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jun. 27, 2016 09:30 AM EDT Reads: 828
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
Jun. 27, 2016 07:30 AM EDT Reads: 994
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 expected in the amount of information being processed, managed, analyzed, and acted upon by enterprise IT. This amazing is not part of some distant future - it is happening today. One report shows a 650% increase in enterprise data by 2020. Other estimates are even higher....
Jun. 26, 2016 05:00 PM EDT Reads: 1,307
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.
Jun. 26, 2016 05:00 PM EDT Reads: 1,214
Internet of @ThingsExpo, taking place November 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 Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - comp...
Jun. 26, 2016 04:00 PM EDT Reads: 1,272
19th Cloud Expo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterpri...
Jun. 26, 2016 04:00 PM EDT Reads: 1,331
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 Day 2 Keynote at @ThingsExpo, Henrik Kenani Dahlgren, Portfolio Marketing Manager at Ericsson, discussed how to plan to cooperate, partner, and form lasting all-star teams to change t...
Jun. 26, 2016 02:00 PM EDT Reads: 1,155
The 19th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportuni...
Jun. 26, 2016 12:00 PM EDT Reads: 1,296
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 19th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world and ThingsExpo Silicon Valley Call for Papers is now open.
Jun. 26, 2016 12:00 PM EDT Reads: 1,122
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...
Jun. 26, 2016 12:00 PM EDT Reads: 1,354
In his general session at 18th Cloud Expo, Lee Atchison, Principal Cloud Architect and Advocate at New Relic, discussed cloud as a ‘better data center’ and how it adds new capacity (faster) and improves application availability (redundancy). The cloud is a ‘Dynamic Tool for Dynamic Apps’ and resource allocation is an integral part of your application architecture, so use only the resources you need and allocate /de-allocate resources on the fly.
Jun. 26, 2016 12:00 PM EDT Reads: 1,094
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...
Jun. 26, 2016 11:00 AM EDT Reads: 1,127
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, discussed how research has demonstrated the value of Machine Learning in delivering next generation analytics to imp...
Jun. 26, 2016 09:45 AM EDT Reads: 645
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 & ...
Jun. 25, 2016 03:00 PM EDT Reads: 1,626
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...
Jun. 24, 2016 01:00 PM EDT Reads: 1,368
Amazon has gradually rolled out parts of its IoT offerings, but these are just the tip of the iceberg. In addition to optimizing their backend AWS offerings, Amazon is laying the ground work to be a major force in IoT - especially in the connected home and office. In his session at @ThingsExpo, Chris Kocher, founder and managing director of Grey Heron, explained how Amazon is extending its reach to become a major force in IoT by building on its dominant cloud IoT platform, its Dash Button strat...
Jun. 24, 2016 12:00 PM EDT Reads: 1,663
industrial company for a multi-year contract initially valued at over $4.0 million. In addition to DataV software, Bsquare will also provide comprehensive systems integration, support and maintenance services. DataV leverages advanced data analytics, predictive reasoning, data-driven diagnostics, and automated orchestration of remediation actions in order to improve asset uptime while reducing service and warranty costs.
Jun. 22, 2016 11:00 AM EDT Reads: 1,377