Dedication
For Jennifer, Aidan, and Tanner
Eric M. Burke
For Mom and Dad
Brian M. Coyner
[] buildfiles Tomcat unit testing [See web applications] arguments assert methods attributes authentication
|
[] block tags (XDoclet) build directory Ant tags targets builds
|
[] classpaths coding configuration content tags (XDoclet) conventions cookies
|
[] databases definitions dependencies deployment deployment descriptors development approaches directories [See mock objects]
|
[] EJBs (Enterprise JavaBeans) environment variables [See also exception handling] exception handling [See XP]
|
[] installation interfaces
|
[] JAR files JDBC code JSPs (Java Server Pages) methods test cases JUnitPerfDoclet
|
[] [See buildfiles] methods assert testing mock objects JDBC code
|
[] [See mock objects] open source tools
|
[] parameters passwords [See also classpath] performance principles principles of XP printing properties system
|
[] servers simplicity source code Ant buildfiles web applications Swing syntax system properties
|
[] tables tags Ant buildfile Tomcat tasks test cases [See test cases] test suites [See also JUnit; unit testing] methods [See principles] Manager application web applications [See also open source tools] [See also unit testing]
|
[] [See UML] Ant JUnit usernames
|
[] WAR files [See also Cactus] web pages web sites WebForm class
|
[] XDoclet EJB files EJB interfaces template files xdoclet.xml files XML files XP (Extreme Programming)
|
1.1 Java and XP
XP is a set of . The four XP principleshave nothing to do with programming languages and tools. Althoughthis book shows a set of Java tools that work nicely with XP, you arenot limited to Java and these tools. XP is a language-independentsoftware development approach.
[1] Check out http://www.agilealliance.com to learn moreabout agile processes.
While XP works with any language, we believe it works well with Java fora few reasons. Most important is the speed with which Java compiles.XP relies on test-first development in which programmers write testsfor code before they write the code. For each new feature, you shouldwrite a test and then watch the test run and fail. You should thenadd the feature, compile, and watch the test run successfully. Thisimplies that you must write a little code, compile, and run the testsfrequently, perhaps dozens of times each day. Because Java compilesquickly, it is well suited to the test-first approach.
The second reason Java is a good choice for XP development isJava's wealth of tools supporting unit testing andcontinuous integration. JUnit,the premier build toolfor Java, makes continuous integration possible even when workingwith large development teams. You will also find more specializedtesting tools such as Cactus and HttpUnit for server-side testing.
Java's power and simplicity also make it a goodlanguage when writing code using XP. Many features of the toolsoutlined in this book, such as Ant tasks and JUnit'stest suites, are built upon Java's reflectioncapability. Java's relatively easy syntax makes iteasier to maintain code written by other team members, which isimportant for XP's concepts of pair programming,refactoring, and collective code ownership.
1.2 Tools and Philosophies
Creating greatsoftwareis an art. If you ask a dozen programmers to solve a particularproblem, you are likely to get a dozen radically different solutions.If you observe how these programmers reach their solutions, you willnote that each programmer has her own favorite set of tools. Oneprogrammer may start by designing the application architecture usinga UML CASE tool. Another may use wizards included with a fancy IDE,while another is perfectly content to use Emacs or vi.
Differences in opinion also manifest themselves at the team andcompany level. Some companies feel most comfortable with enterpriseclass commercial tools, while others are perfectly happy to buildtheir development environment using a variety of open source tools.XP works regardless of which tools you choose, provided that yourtools support continuous integration and automated unit testing.These concepts are detailed in the next chapter.
| We are very skeptical of the term"enterprise class." Thistends to be a marketing ploy, and actually means"the features you really need,"such as integrated support for free tools like JUnit, Ant, and CVS. |
|
1.2.1 The IDE Philosophy
Many
[2] XDoclet allows you to generate any kind of code and thus workswith any application server.
This book does not cover commercial development environments andtools. Instead, we show how you can use free tools to build your owndevelopment environment and support XP practices. Perhaps in a signof things to come, more and more commercial development environmentsnow provide direct support for the open source tools covered in thisbook. With free IDEs like Eclipse and Netbeans growing in popularityand functionality, you will soon be hard-pressed to justify spendingthousands of dollars per developer for functionality you can get forfree.
[3] Both authors use IntelliJ IDEA, a commercialIDE available at http://www.intellij.com. Although it costsaround $400, we feel its refactoring support easily adds enoughproductivity to justify the cost.
1.2.2 Minimum Tool Requirements
Regardless of whether you choose to use open source or commercialtools, XP works most effectively when your tool selection supportsthe concepts mentioned at the beginning of this chapter. These threeconcepts are automation, regression testing, and consistency amongdevelopers.
1.2.2.1 Automation
XP requiresautomation. In an XP project,programmers are constantly pairing up with one another and working oncode from any given part of the application. The system is coded insmall steps, with many builds occurring each day. You simply cannotbe successful if each programmer must remember a series of manualsteps in order to compile, deploy, and test different parts of theapplication.
People often talk about "one-buttontesting" in XP, meaning that you should be able toclick a single buttonor type a simple command like ant junit inorder to compile everything, deploy to the app server, and run alltests.
Automation also applies to repetitive, mundane coding tasks. Youincrease your chances of success by identifying repeating patternsand then writing or using tools to automatically generate code.Automation reduces chances for human error and makes coding moreenjoyable because you don't have to spend so muchtime on the boring stuff.