Although developers may expand the most effort testing a Web application's source code, the correct operation of an application depends on non-source files as well, such as localization bundles, XML configuration files, or HTML documents. A single misplaced, or mis-named, file can cause parts of an application to fail, yet traditional developer testing tools are not very helpful in checking for the presence, and correct reference, of all the required application files.
In this interview with Artima, Bill Roth, BEA's vice president and unit executive for the company's BEA Workshop developer tool, suggests a few ways to manage such application dependencies reliably, especially in the context of open-source Web frameworks:
[Managing such dependencies] is a second-order debugging problem... While [open-source frameworks] are conceptually simple, what you have is a lot of artifacts that have interdependencies. So you may have an XML file, which may point to an HTML file, which may point to a JSP or a tag library reference. As you package the application and deploy it, you find out that, for example, I typed a wrong path for the taglib, or used the wrong HTML file name, only when I ran the application. [This] just extends the compile-debug cycle.
One dependency management strategy Roth mentions in the interview is careful naming:
Pay attention to naming. Really think hard about the hierarchy inside your Web application, and what you call things. There are a number of different solutions I've seen to this, including using a sort of Hungarian notation ... for your files so you understand what the files are, what types [they] are, how [they're] being used.
Understand the different asset types and different artifact types, [such as] config files, localization resource bundles, things like that. Really think carefully and clearly about naming. Have a naming strategy or a naming architecture for any decent-size Web application...
Consider a taxonomy of your assets... A typical Web application construct is to have an images file inside the deployment unit. But if you've got different kinds of images, if you have a lot of different icons, and you may have some images or nav bars, separate them out by type. Also, don't use acronyms. Make sure that these things are clear, because if you're ... hit by a bus, the next guy is going to have to come in and fix it.
Roth also mentions in the interview a new BEA tool, AppXRay, that helps identify a project's dependencies:
AppXRay is part of BEA Workshop. It scans the application while you're developing at design-time, and allows you to map out the structure of your application. It allows you to see what page goes to what other page, which page contains what JPG files... If you forgot to include the name of the Chinese localization, it will tell you at design time, whereas previously you would have had to go through the entire deployment cycle, and only when someone clicked on that Chinese localization would you have learned of the problem.
|Bill Roth, vice president and unit executive of BEA's Workshop division, talks managing dependencies in a Web application. (6 minutes 21 seconds)|
What strategies do you follow to manage dependencies in your applications?Post your opinion in the discussion forum.
Have an opinion? Readers have already posted 7 comments about this article. Why not add yours?
Bill Venners is president of Artima, Inc. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill also serves as an elected member of the Jini Community's initial Technical Oversight Committee (TOC), and in this role helped to define the governance process for the community.
Frank Sommers is Editor-in-Chief of Artima Developer. He also serves as chief editor of the IEEE Technical Committee on Scalable Computing's newsletter, and is an elected member of the Jini Community's Technical Advisory Committee. Prior to joining Artima, Frank wrote the Jiniology and Web services columns for JavaWorld.
Artima provides consulting and training services to help you make the most of Scala, reactive and functional programming, enterprise systems, big data, and testing.