|[ Team LiB ]|
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
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.
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.
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:
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.
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 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.
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/.
|[ Team LiB ]|