[ Team LiB ] Previous Section Next Section

Other Helpful Software

This section covers other helpful software in detail normally used in a development environment. This normally used software includes version control software, modeling tools, testing software, and build and deployment tools. This section is meant to introduce you to such tools if you aren't currently using them.

Version Control Software

When several people are developing software over different releases, it becomes necessary to manage source code making up the project. Version control software such as Rational ClearCase, Merant PVCS, Microsoft SourceSafe, and Concurrent Versions System (CVS) helps manage this process. The main benefits of version control software are

  • Organization of software resources Allows the separation of projects into different categories and developers can retrieve and maintain files from one central repository.

  • Track changes easily All changes to the program are logged when the file the developer is working on is checked back in.

  • File ownership tracking If many developers are working on a project, tracking software can identify who is working on what files.

  • Rollback changes If a developer makes a change to the file that breaks the program in some way, all the changes he made can be rolled back.

  • Parallel development Two or more developers can work on the same project or files at the same time and version control software will merge the work and notify whether they modified the same lines of code.

Version control enables you to track software releases, changes made, and editors of project files. This prevents teams from overwriting files and allows previous versions to be debugged and replaced without installing the new release. Of the four mentioned previously, CVS is a leading alternative. It is open source, and therefore free. If you're not familiar with version control and want to try it, check out CVS on the Web at www.cvshome.org.

Modeling Tools

As software projects increase in size, efficient design and modeling becomes crucial. This is especially true in object-oriented programming (OOP). Implementing proper OOP technique isn't an easy task, but it's greatly facilitated using software tools.

Modeling is usually done in a graphical environment by creating models representing your software. The standard modeling language in use is Unified Modeling Language (UML). UML enables architects to detail system requirements, develop a solution, and implement that solution with a clear and concise roadmap. UML provides basic building blocks of software along with a way to express complex relationships among these blocks. Some of the more popular tools are Rational Rose, Borland JBuilder Enterprise, and Visio, which is a less expensive alternative to the more advanced tools.

The sample Rose model in Figure 4.1 shows a class-scheduling model. Software architects, designers, and developers have found UML to be useful planning, writing, and maintaining software. Pictures clarify and exemplify the software process, which is why design tools are being used more often. During the construction phase of a project, products such as Rose can create all the classes and methods for a developer. This enables the developer to start writing code immediately. The diagrams then serve as a map of the development effort and facilitate understanding of the system. After the system is finished, UML documents serve as support documentation, allowing maintenance to be performed quickly and efficiently.

Figure 4.1. Rational Rose design software in action.

graphics/04fig01.jpg

Testing Software

Testing is an important phase of any software project. When software isn't tested properly, the end product suffers tremendously in quality. Instead of finding bugs when the product is still in the developer's hands, the bugs are experienced by the end users, who then form a negative opinion of the product or Web site. Or the entire site goes down often, costing the company thousands of dollars in downtime.

Testing software can be an arduous task. Even a simple change could affect an entire application and render it useless. Developers never seem to have enough time to write test cases, and always leave it to functional testing to catch all the runtime bugs.

Testing can be performed manually or automatically. Testing manually is beneficial when initially testing random user errors. After these errors are quantified, an automated testing script can be created. That script can then be run on periodic basis such as nightly or weekly, and a report of failures can be diagnosed and fixed as they occur. One such scenario is a test after a nightly or weekly build. When the build is complete, the testing software is run and any bugs are found right away, while the code is still fresh to the developer. Some of the most common automated testing solutions include Rational TestStudio, Mercury Interactive WinRunner, Segue SilkTest, and JUnit, just to name a few.

Automated testing provides several benefits that include the following:

  • Reduced testing time An automated testing environment can run thousands of tests in a 24-hour period.

  • Consistent testing procedures The testing procedure is consistent and there won't be any skipped scenarios.

  • Reduced QA costs More bugs will be caught and fixed in development, which means less time analyzing software after it's released.

  • Product quality improved The overall benefit of automated testing is the enhanced quality of the final software product.

One product that is gaining popularity is JUnit. JUnit is a free testing framework for creating tests that call Java methods and classes with data. Writing an automated test in JUnit requires writing a Java class with a special, yet simple, syntax.

JUnit has a text or graphical suite-testing tool that runs every test in each test case and reports whether there's an error. Figure 4.2 shows the graphical test in progress. A test can be run every time a build is done to verify that methods still function properly. This saves countless hours of debugging and catches the easy mistakes. Implementing a testing framework is not nearly as difficult as maintaining the framework. The tests are easy to write, but deadlines are usually so tight on software projects that there isn't enough time to finish coding let alone write tests for the code. The best practice is to implement test cases first and then write the software. At the end, you can run the test and validate that your software works. Information about JUnit can be found on the Web at www.junit.org.

Figure 4.2. JUnit interface testing an application for errors.

graphics/04fig02.jpg

Nightly or Weekly Builds

Nightly or weekly builds are important for maintaining a good testing environment. In large software applications, the application is built and tested nightly to catch any errors or prove the software's reliability. In a nightly build, the software source is retrieved from the version control repository, compiled, packaged, deployed, run, and tested.

WebLogic 8.1 is packaged with a tool named Ant that can greatly reduce this timeframe. Ant works with XML files that describe what files to compile and where to put them. It can be configured to use alternative Java compilers and to create applications in a variety of formats, including .jar, .war, and .ear. Many plug-ins are available for Ant, including ones to run JUnit tests. Ant works with both Windows and Unix, and is covered in depth in Chapter 7, "Deploying Web Applications."

Performance-Testing Tools

Performance testing is critical in delivering fast, reliable software in a scalable environment. Typically, there are three steps for performance testing: load testing, evaluating results, and optimization.

  • Load Testing Load testing ensures that the application will have good response times during different usages. Tests usually contain a low, medium, high, and maximum load. The number of concurrent hits for each category depends on your specific need.

  • Evaluating Results Once the testing results are in, evaluate the results to find and identify the problems.

  • Optimization Optimize the code as needed and test again. Repeat these procedures until the application runs as expected.

Performance testing is one of the last tests done before software is released, although it can be done periodically to catch bad algorithms and poor design choices early in development. These tests simulate real-world usage on the application. Performance-testing suites can cost thousands of dollars, but are worth every penny if the application being delivered will be subjected to high volumes. Some of the leaders in Java software performance testing are JProbe Suite by Quest Software, LoadRunner by Mercury Interactive, Optimizeit by Borland, and JMeter. JMeter is an alternative to high-cost suites. It's an all-Java testing tool that's available for download from apache.org. JMeter provides limited basic testing utilities, but setting up scripts and analyzing data is straightforward, and the tool is free.

Figure 4.3 shows a results screen of a test for speed on login. JMeter allows for multiple threads and infinite loop testing against the designated server. JMeter is a good basic step if a performance-testing suite isn't readily available. More information about JMeter can be found on the Web at jakarta.apache.org/jmeter/.

Figure 4.3. JMeter results screen for a simple HTML login test.

graphics/04fig03.jpg

    [ Team LiB ] Previous Section Next Section