Debugging

Working within the context of VisualAge, WebSphere, and DB2 presents significantly more challenges for debugging and testing than working with more conventional development tools and environments.  Brown, et. al., provide a number of suggestions pertaining to testing suites.  Here, several suggestions are made with respect to development and testing strategy, and several potential problems are noted.  


Master the Environment

Working within these enterprise system environments is different.  It is essential that you recognize this and consciously and deliberately develop expertise in their use.  

  1. Understand what they do and how the relate to one another.  
  2. Become familiar with the major functions provided by each and understand what functions are used to accomplish particular steps in the development process, such as creating a CMP bean, testing that bean alone, testing it with a session bean, and deploying it.  This is not as easy as it should be because of limitations in documentation.  You should see relevant IBM Redbooks, the on-line documentation available through the VAJ help menu, and any other documents and resources that may be available.
  3. Specialize.  Each member of a team should take responsibility for becoming a guru on some portion of the environment.  Together, you should have someone who knows and is responsible for each of the tools and systems you will be using.
  4. Share.  It is essential that you pool expertise.  Not just within a teams but among teams.  I strongly suggests that members of the various teams who are responsible for a particular technology, such as VisualAge or WebSphere deployment, view themselves as a working group, schedule working sessions, and communicate with one another about problems they are having and the solutions they come up with.

Control Complexity

Complexity will kill you.  If you don't simplify and structure your development process, your project will fail.  On the other hand, if you can begin with very simple components that not only work but that you thoroughly understand, and build out from them incrementally, the environment can help you a great deal.  It wants to do a lot of your programming and other development tasks for you through various wizards, generated code, declarative attribute facilities, and container supported operations.

Here are several suggestions for controlling complexity:

  1. Start at one end of the process or another, such as a CMP bean or a servlet.
  2. Develop and test a very simple instance of that component.  If it is a servlet and you are using XML/XSL, it will include getting the required Java resources properly configured so that they may accessed at run time.  If it is entity bean, it will insure that the container can access the database.
  3. Use the VisualAge test environment for initial testing.  Deployment involves extra complexity.  Get it working in VisualAge first before moving to another context.
  4. Don't go on to other components or add other function until the first component is working entirely as expected.
  5. With respect to entity beans, once it is working properly, test it with a simplified session bean within VisualAge.  To do this, you will need to get them into the same EJB group and run them within the same VAJ EJB test container.
  6. Learn to use the debugger.  This is not just a convenience but a necessity.  Because so much infrastructure is generated or provided by the environment, often the only way to see where a problem is occurring is through the debugger.  There, you can set break points and follow execution down into generated and/or provided classes as well as the ones you have written.

Deploy Strategically

After you have developed and tested your components within VisualAge, deploy and test them within WebSphere by following a deployment strategy that you develop.

  1. Master the WebSphere environment. 
  2. Create a directory structure outside the root of WebSphere proper.
  3. Begin with a very thin, Hello, World, sequence of components, including a servlet that provides both Controller and View function, one or more "Process User Action" servlet engine components, and a pair of Session and Entity beans.  Deploy all of these components and get them working, paying particular attention to classpaths.
  4. If you are planning to use XML/XSL, deploy a slightly more complex Hello, World application that requires run time access to the relevant Java jar files.
  5. Next, deploy your first thin project sequence, described above.
  6. Develop and thereafter use a deployment policy and procedure that all team members understand and follow to minimize side effects of one member's work on another.  This might involve only a single person doing all deployment, the group doing deployment together, separation of object ownership for purposes of deployment, etc.  Whatever your policy/procedure, make them explicit and follow them, with the caveat, of course, that they may need to be revised as your work -- and your understanding of it -- evolves.

Good Luck, Work Hard, but Work Smart!