Macromedia Coldfusion MX 7 Web Application Construction Kit
When many developers get a new project to work on, their first instinct is usually to start coding right away. It's easy to understand why. Those first few hours or days of coding can be a lot of fun. The "inner geek" in each of us gets a special thrill from sinking our teeth into a new project, watching an application take shape, and carving something unique and useful out of thin air. Plus, there's often a deadline looming, so it seems best to start writing code as soon as humanly possible. The problem is that even the simplest applications have a way of becoming much more complicated than they seemed at first. Nine times out of ten, if you take the time to plan your application and development process right from the start, you will do a better job in less time. Of course, people say that about almost everything in life. But in Web application development, it really is true. Admit it! Your inner geek is already telling you to skip this chapter and get on with the coding. Resist the geek, if you can. The advice in this chapter will mean a bit more work for you up front. You might find that you even need to write a few documents. But you probably will end up doing more cool stuff and less tedious work if you know exactly where your application is headed at all times. Really. Seriously. Honest. Your inner geek might even buy you a drink when you're done. Defining the Project
The first thing to do is to ensure that the project is as completely defined as possible. You need to know exactly what type of application to build, and that usually means doing some research and asking lots of questions. In a perfect world, you would already have a written description of the application that defines its every aspect. You would know exactly what the expectations are for the project, and who will be testing it, using it, and benefiting from it. You would have complete understanding of every aspect of the project, from what technologies should be used to how the database should look. In reality, you might have only a short description, such as, "We want to personalize our online store," or, "We need an accounting section in the company intranet." Sounds great, but you can't exactly start working yet. The Importance of Being Inspired
If you can, try to have a vision about the project early on. Make it ambitious. Figure out how people are thinking about the project, and try to come up with some twist or feature that takes it to a whole new levelsomething an end user would be happy to see, and that you would be proud to implement. Why? Because it's important for you to be as interested in the project as you can be. If you're having fun during the development process, the application will turn out better. If at first the application sounds like something you've done or seen a million times before, try to think of something to add to make it unique. Even if the project already sounds difficult or daunting, think of some way to make it even more of a challenge. Then, after you've gotten yourself excited about the project, try to get everyone else excited about it, too. Come up with a trademark-like name or code name for the project (perhaps from a favorite movie or a play on words based on the name of your competition). Talk about the project as if it were the cure for all diseases, as if it were going to save the world. Sell the thing. Even if it's filled with irony, your enthusiasm will bubble over onto the next desk or into the next room. At the very least, the project will be a little bit more fun. And how can that not be a good thing? Understanding the Project
Now that you're enthused about the project, you need to get yourself educated as well. Before going further, be sure you know the answers to these questions:
Conducting a Few Interviews
We recommend that you conduct a few informal interviews among the people who might actually be using your application when it's completed. Depending on the project, that might mean people within the company or potential end users on the street. Ask these people what they would like to see in the application. How could it be even more useful to them? NOTE A fun question to ask is, "If there were only a single button to click in this new application, what should it be?" At first, you might get sarcastic answers, such as, "It should find me a better husband," or "It should do my job for me," but you'll also get serious answers that can be quite telling.
These potential users will likely tell you more about how your application will actually be used than your normal contacts within the company can. They often are more likely to be able to describe what they need in ordinary terms. You might find that you think about the project differently after a couple of these short interviews, and you may end up reevaluating the importance of various features. TIP If your application is meant to replace or improve a process that these people perform manually or with an existing application, you might want to observe them doing their jobs for a short time. You might find that users spend most of their time doing task X, while you intended the application to assist primarily with task Y. This interview process serves another, more subtle purpose as well. It associates a real persona face, or several faceswith the project for you. When you reach a stumbling block later, or when you design a form, you can have these people in mind. Perhaps without totally realizing it, you will actually be creating the application for these people. When it's finished, you are likely to have improved their day-to-day work experiences or somehow made things more fun or easier for people using your application at home. You'll find it more rewarding, and your application will have much more perceived value. Setting Expectations
This is perhaps the most important thing to nail down as early as possible. Even the savviest people have a way of expecting things from an application that they never told you about. Setting appropriate expectations is perhaps the most important thing to nail down as early as possible in the process. Discussing the finer points of the project with your client can go a long way toward establishing reasonable expectations. Keep in mind that many of these items are matters of give and take. You might frame the discussion by clearly defining the choices: "The upside of doing this would be X, but the downside would be Y." Consider:
Knowing the Players
Unless you are producing every aspect of the application on your ownincluding artwork, testing, and deploymentyou need to know who is going to be working on the various aspects of the project. Depending on the circumstances, you might need to assemble a team on your own. A team usually consists of the following basic positions. Even if one person performs more than one function, be sure you know who is who:
Fact Finding
Next, it's time to do a bit of research. This might sound like a lot of work, but the truth is you can often do the research suggested here in a couple of hours. It is almost always time well spent. Looking at Similar Sites
Spend some time searching the Internet for sites that are similar to your project. Even if you can't find a Web site that does the exact same thing as the application you're building, at least try to find a few sites that are in the same conceptual space or that have pages that present the same type of information that your application will present. For example, say one of your pages is going to be an "Advanced Search" page and another will present data in rows and columns. Find the best examples you can of such pages. What do you like about them? What don't you like? How does the use of color or spacing affect your opinion of the existing pages? When do the best sites use a button instead of a link, and why? When do graphics help, and when do they just get in the way? Decide Which Technologies to Use
You also should research and decide which technologies you will use. Most likely, ColdFusion will give you most of the functionality you need, but you still need to answer a few questions:
Investigating Existing Custom Tags, UDFs, and ColdFusion Components
The ColdFusion Developer's Exchange site is a great place to look for existing Custom Tags, UDFs, or ColdFusion Components that might help you build your application more quickly. Using these prebuilt extensions to ColdFusion often enables you to get your application finished more easily. Why reinvent the wheel if someone else has already done the work and is willing to share it with you for free (or for a nominal charge)? The Developer's Exchange is located at http://www.macromedia.com/cfusion/exchange/index.cfm. The Common Function Library Project (http://www.cflib.org) is an excellent resource for UDFs. CFCZone (http://www.cfczone.org) is a repository of ColdFusion Components. Searching the ColdFusion Forums
Another good place to go during the planning phase is the Online Support Forums for ColdFusion, where users discuss problems and answer questions for each other. Support engineers from Macromedia also participate in the forum discussions. Try running searches for the type of application you are building or, for specific features you might not have fully formed in your mind yet. It's likely you'll find message threads that discuss various approaches of displaying the type of information you need to present, as well as any pitfalls or gotchas to keep in mind. You'll probably find code snippets and examples you can adapt as well. The ColdFusion Support Forums are located at http://webforums.macromedia.com/coldfusion. Investigating Standard or Third-Party Extensions
As mentioned, ColdFusion can invoke and communicate with Java classes and ActiveX objects. ColdFusion can also invoke and communicate with Web Services. You don't have to write Java, C++, or Visual Basic code to use these items; instead, you use them through CFML's createObject() function or through the <cfobject> tag. The basic idea is the same as when using Custom Tags: Why reinvent the wheel when someone has already done the work for you? Therefore, it is worth a quick look on the Internet to see whether third-party Web Services, Java classes, or ActiveX controls are available to help with some part of the functionality your application is meant to provide:
NOTE A complete discussion of how to use these objects in your ColdFusion templates is beyond the scope of this book. See Advanced Macromedia ColdFusion MX 7 Application Development (Macromedia Press, ISBN: 0-321-29269-3) for complete explanations and examples. Also see Appendix B, "ColdFusion Tag Reference," to learn more about the <cfobject> and <cfinvoke> tag, and Appendix C, "ColdFusion Function Reference," to learn about the CreateObject() function.
|