Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Books Media Book Reviews IT Technology

Java Meets XP: Two Reviews 211

Peter Wayner writes: "In a world where Ali had to meet Frazier and Luke had to meet his father, it was only a matter of time before buzzwords like Java and eXtreme Programming found themselves together on the same marquee. A pair of new books examines some open source Java development tools and outlines how they can be put to use by those trying to master their workload by adopting the techniques of eXtreme programming." Read on for his latest review, which is really two reviews in one.
(see each)
author (see each)
pages (see each)
publisher (see each)
rating (see each)
reviewer Peter Wayner
ISBN (see each)
summary Two books which explore the use of Ant in Java software development

The two books are excellent examples of how the book industry organizes and disciplines the often crazy explosion of new tools, approaches, structures and metaphors developed by the software industry. Ant: The Definitive Guide by Jesse Tilly and Eric Burke comes from O'Reilly, the masters of producing missing manuals for open source projects. The other, Java Tools for eXtreme Programming: Mastering Open Source Tools including Ant, JUnit, and Cactus by Richard Hightower and Nicholas Lesiecki was published by John Wiley and Sons. Both provide a clear, example-driven exploration of the tools at hand.

The books are probably driven by the success of Kent Beck's Extreme Programming Explained: Embrace Change , a manifesto that outlined Beck's belief that the best way to develop code was with small teams of programmers and users who constantly reworked the software. His most controversial and attention grabbing notion demanded that the programmers work in pairs sharing one computer, one mouse and one keyboard. The constant interaction forced everyone to actually communicate with each other without sending emails and that, more than anything else, may be responsible for the success of his vision. His book spawned a few others on how programmers can plan to apply his vision.

Meanwhile, on the other side of the buzzword galaxy, the Apache group was quietly creating some of the coolest Java development and deployment tools around. Ant was and still is one of the most revolutionary, even though it was just a simple reworking of the classic UNIX make command. Its creator, James Davidson, grew so frustrated with the shell interface of the make command that he wrote a Java-centric version that moved all of the compilation, compression, and distribution inside one Java process. Now, no one has to wait for another Java Virtual Machine to start up to compile each class file independently.

While Davidson's Ant isn't much different than make at first glance, it's hard to overestimate the power of giving programmers a clever tool with plenty of hooks into the development process. Anyone can write new tasks for Ant, and some clever folks have built great new widgets that do things like enforce style guidelines or grab new code from a CVS tree. The structure of Ant lets the programmer dig deeply into the build process. The organic growth and dynamic flexibility shows how close Java can be to Lisp.

Tilly and Burke do a good job capturing the spirit of the tool. Their book follows O'Reilly's time-tested and market-proven simple-examples technique to illustrate how to use Ant for your projects. The chapters in the first half of the book outline how to use and extend Ant for your project. The strength of the book may be the way the authors casually include practical advice about the bugs and idiosyncracies of the tool. While Ant is quite capable, there are a number of little limitations to the XML parser that can drive new users a bit nuts. The second half of the book is a detailed description of the API, the data types and the other practical documentation.

In one sense, it's not really fair to lump this book in with all of this gloss about Extreme Programming. because it's just another methodical O'Reilly book with Dover artwork on the cover. It's important to realize that these tools aren't directly tied to the extreme programming movement. Ant was just created by a Java programmer who hated to wait. Everything else came afterwards when he opened the API.

Ant: The Definitive Guide
author Jesse Tilly & Eric M. Burke
pages 260
publisher O'Reilly
rating 7
ISBN 0-597-00184-3
summary A methodical, in-depth look at the Java tool.

The other book, however, explicitly illustrates how some popular open source tools can help the process of extreme programming. Hightower and Lesiecki's book is much broader than Tilly and Burke's because they want to tackle so much more. They don't want to just provide a missing manual for the tool-- they want to give the world a road map on how they use Ant and its cousins JUnit, HTTPUnit, and Cactus to build better applications. It should be noted that Hightower and Lesiecki work for a consulting group called eBlox and a number of other eBlox programmers are listed as contributors to the book. I think it's fair to say that anyone who hires eBlox will get eXtreme Programming results built with this methodology.

The best part about this book is the wide scope. Ant remains the central taskmaster responsible for building the software, but the book explains how to incorporate other tools for testing the software. The authors embrace one of the extreme programming central beliefs that programmers should define how to test their code before it is actually written. The book explains how to use JUnit, Cactus, and HTTPUnit to set up rules to test every class file. After ANT fires up the compiler, it turns around and runs the tests on the code.

Java Tools for eXtreme Programming
author Richard Hightower and Nicholas Lesiecki
pages 513
publisher John Wiley and Sons
rating 7
ISBN 0-471-20708-X
summary How to use some Java tools to transform extreme programming theory into reality.

I don't think that eXtreme Programming or any of these tools is the last word on the subject. The biggest problem is that testing a piece of code is guaranteed to be fairly rudimentary. No programmer can come up with test cases to push all of buttons in all possible combinations. The structure and discipline provided by this approach can help, but the book makes it clear that no amount of pairs programming or extremism will remove the need for the guidance of good programmers.

If anything these tools and the books about them should serve as inspiration for the next round of tools even more focused on extreme programming. The tools are impressive, but there is plenty of room for more innovation. None of them is aimed at explicitly coordinating the work of multiple developers and none of them is designed to provide much structure to the refactoring process. These areas are still very much arts, but there's no reason why tool suites like Ant can't evolve some rational approach to solving them. Perhaps the Slashdot audience can provide some informative postings with pointers to the next generation of cool tools.

Hightower and Lesiecki's book feels a bit more rudimentary and basic than Tilly and Burke's, in part because they cover so much more ground. Although their book is broader, it doesn't go into as much depth about Ant as Tilly and Burke's. The examples are simpler, too, and Hightower and Liesiecki seem mainly interested in getting you excited about building and testing software with the tools. There just isn't as much room for details. If you're interested in learning as much as you can about Ant, choose the book devoted to it. If you want to learn how to use a diverse set of tools to build and test your program in an extreme way, go for that book.


Peter Wayner blends the buzzwords of security, privacy, and data warehousing together in his latest book, Translucent Databases. It shows how to ensure that only the right people see the right information and the wrong people get nothing. His other new book, Disappearing Cryptography, mixes the buzzwords of being, nothingness, steganography, and cryptography. You can purchase both Ant: The Definitive Guide and Java Tools for eXtreme Programming from bn.com. Slashdot welcomes readers' book reviews -- to submit yours, read the book review guidelines, then hit the submission page.

This discussion has been archived. No new comments can be posted.

Java Meets XP: Two Reviews

Comments Filter:
  • by manual_overide ( 134872 ) <slashdot@duder.net> on Friday June 14, 2002 @11:33AM (#3701967) Homepage Journal
    Check out my double nested for loop ollie nose-grind, dude!!
  • so? (Score:2, Funny)

    Now you can run java on XP.

    Too bad you can't run VB on solaris...
    • too bad??? not running VB on solaris might as well be a security feature opf Solaris as it protects it from run away programs and HORRIBLY coded apps...
      • It was a joke, because java has never run very well under windows.
        • Compared to the limp along performance on Linux? You have to be a real zealot ready to ignore the blatant evidence to say that Java on Linux is awful, particuarly SWING performance... The better network performance of Linux makes it suitable for hosting Java servers but for client side you can forget it

          Before anyone flames me, I code a lot of Java and I currently develop in it for a living and have done it under both Linux and Windows so I can speak with some authority on the matter.
      • On top of that, VB isn't so bad. It's the programmers that are idiots. No one in their right mind would write anything but the interface in VB. That's what dlls are for.

        Java was meant for a 64-bit environment and runs about as fast as a dead snail on a 32-bit system.
      • not running VB on solaris might as well be a security feature opf Solaris as it protects it from run away programs and HORRIBLY coded apps...

        Actually, a VB compatible interpreter [gnome.org] runs on the Solaris operating environment. What protects the system from runaway VB apps is not a lack of VB but the presence of working permissions on the system.

    • For everyone who doesn't get the joke, it's because XP stands for eXtreme Programming, a means by which you can generate assloads of documentation and spend lots of time in meetings... Er, program more efficiently, that's right. This has nothing to do with Windows.
    • Considering Java is a language that only requires an interpreter that works with the OS on any machine.

      You can run java on any computer, as long as you have an java interpreter on that machine as well. So hypothetically, you've always been able to run java in XP, you just needed the interpreter.(or the processor understands javacode, which is highly unlikely, Probability --> 0)

      Just a humourous thought. :-) I personally love java... when used properly.
      • (or the processor understands javacode, which is highly unlikely, Probability --> 0)

        Talk to Transmeta. Transmeta's Crusoe processor [transmeta.com] runs programs through dynamic recompilation of bytecode. Current products emulate Intel x86 bytecode, but the Code Morphing recompiler is a piece of software and can be easily replaced with one that understands Java bytecode or .NET MSIL bytecode.

  • by jdbo ( 35629 ) on Friday June 14, 2002 @11:39AM (#3702033)
    ...there was an instant spark between us... Despite the fact that I'm an OS committed to my hardware, I could definitely see something happening... Sure, she was openly platform-promiscuous, but I knew she always used VM protection... besides, both of us were protective of our own (code) secrets... and I must say that the mystery attracted me. So, I thought, why not?

    ...if only I had foreseen Bill and Scott walking in on us that one day... lord knows why they were hanging out together, but suspicion can make people do crazy things...
  • Why two reviews? (Score:3, Insightful)

    by Codex The Sloth ( 93427 ) on Friday June 14, 2002 @11:44AM (#3702074)
    It's more like 2 quater reviews than "two reviews in one". Not even a table of contents? Jesus! Especially since the books have exactly zero to do with each other.

    IMHO, Anyone who needs book to figure out Ant should be shot.
  • An article about Extreme Programming uses an acronym that makes everyone assume it's about Windows XP. How foresighted.
    • Re:Brilliant... (Score:1, Informative)

      by Anonymous Coward
      XP fans have been calling our practice XP since long before the latest version of Windows was released. You seem to think we should compensate for Microsoft's lack of foresight? Oh, I see, you think we should just roll over and get a new acronym everytime Microsoft makes a new release. I'm sure you no longer use the word "ME" do you?
      • It's worse than that, actually. Once XP became so overloaded, and for other reasons, a lot of Extreme Programming related stuff has been broaded in to the family of "Agile" methodologies. So the word Agile appears where XP might have appeared.

        Now, of course, Microsoft is using the word Agile regularly in adveritisng.

        Ugh. Maybe the XP community should embrace a new name for it. Call it "Fred". Of course, MS could come out with a replacement for MS Bob with that name :-)

  • Cruise Control (Score:5, Informative)

    by e2d2 ( 115622 ) on Friday June 14, 2002 @11:46AM (#3702092)
    When reading about XP, I see a lot of mentions of Ant, XUnit, and cactus, but not much mention of Cruise Control [sourceforge.net]. It builds upon Ant to allow continuous integration, one of the important piece of XP that should and can be automated.

    • Re:Cruise Control (Score:5, Informative)

      by smagoun ( 546733 ) on Friday June 14, 2002 @12:01PM (#3702228) Homepage
      Arguably better than Cruise Control is Anthill [urbancode.com], which is a continuous build tool that takes a different approach. Unlike CC, Anthill, doesn't require you to muck with your project's build script - it works with your existing scripts, which is a big plus for me.

      Even more important is Anthill's support for multiple projects, complete with dependency graphs. Support for multiple projects is such a must-have feature (for me, anyway) that choosing Anthill over CC was a no-brainer. It's even open-source, so you can tweak it to your heart's content.

    • Re:Cruise Control (Score:2, Informative)

      by Channing ( 514228 )
      Actually the XP community like CruiseControl a lot. A list of tools for XP can be found here: http://c2.com/cgi/wiki?ExtremeTools

      Channing
  • by JLyle ( 267134 ) on Friday June 14, 2002 @11:46AM (#3702096) Homepage
    In one sense, it's not really fair to lump this book in with all of this gloss about Extreme Programming because it's just another methodical O'Reilly book with Dover artwork on the cover. It's important to realize that these tools aren't directly tied to the extreme programming movement. Ant was just created by a Java programmer who hated to wait. Everything else came afterwards when he opened the API.


    It's important not to lose sight of this in all the troll^H^H^H^H^H enlightened debate about XP that will surely accompany this review. We used Ant for a number of large Java development projects and we were not an XP shop by any stretch. As the reviewer says, Ant really shines when you start making use of various extensions. In our case, we were able to wrap most of the software release process (synching from Perforce, rebuilding and packaging the code, and uploading the distribution to an ftp site) within a collection of Ant tasks.
  • by Codex The Sloth ( 93427 ) on Friday June 14, 2002 @11:47AM (#3702103)
    So I noticed the links at the bottom have a sourceid parameter in them which as I recall, is bn.com's affiliate system. Am I wrong or is this just a blatant cash grab?

    Maybe the slashdot editors could pick up the clue stick on this one?

    • You assume that it is the reviewer's affiliate number. Perhaps you assume too much. Remember, /. has been looking for new revenue streams. Perhaps they have the cluestick firmly in hand. If that's the case, it's a fairly innocuous revenue hook. I don't mind it much.
      • Yes, I agree that's a possibility. I'm not sure how innocuous it is -- I mean, aren't the book reviews supposed to be impartial? Why don't we just let the authors write them?

        Granted this is all largely theoretical as the vast majority (all?) of the reviews on slashdot are crap. They frequently are less informed than the average reader reviews on Amazon...

  • /. review (Score:3, Informative)

    by loconet ( 415875 ) on Friday June 14, 2002 @11:48AM (#3702107) Homepage

    Some more information about Java Tools For Extreme Programming can be found on this earlier review [slashdot.org] of /.

  • by CONTROL_ALT_F4 ( 585063 ) on Friday June 14, 2002 @11:50AM (#3702133)
    Is it just me, or does anyone else get irritated hearing the new idiot buzzwords that come out every week? (Such as eXtreme Programmming?)
    Some of us are hard working, college educated computing professionals, not dim-witted adolescents with the urge to jump off of a cliff without a parachute. We need to take our field or work back from every idiot that can put the three brain cells together required to write a stupid book, or to introduce a brand new moronic buzzword.
    (Ok, I'll get off my soapbox, you can now mod me to -1000 loser-troll-flame-bait)
    • by Mr.Sharpy ( 472377 ) on Friday June 14, 2002 @12:02PM (#3702241)
      Well I am getting tired of not just a buzzword, but the letter X. Everything has to have an X in it these days. XML (and all the X's in it's thread), OS X, XP, eXtreme Programming. X is the new e for the post dot-bomb economy. In fact, I blame the rise of X near the end of the internet bubble for it's collapse. With the usurpation of 'e' (as in eBusiness, eTailors, etc.) suddenly investors were aghast to find that thier latest schemes did not include the latest buzz letter! And thus the loss of confidence in the 'e' economy.

      I predict that Q will soon rise and topple X as king of the buzzletters.
      • Thank God someone else notices this too! If it isn't a buzzword or buzzletter, my managers want nothing to do with it. The marketing of most technology-oriented companies and groups are certainly right on target on getting the guys with the money hooked on buzz-mania.

        The thing I find most distressing is that many people don't try to learn how to use the tools they have to solve a problem, and instead wait for a new tool to emerge and solve the problem for them. We all know that tools don't solve problems, people (with or without tools) solve problems.

        Anyways....I'm buzzing...
      • "x" was popular a long time ago. (remember PC XT) And now this beast is coming back. The history repeats.

      • No, I disagree: "M" for mobile will be hot.

        Example: mMode [attws.com]

        Err. I can't think of more. Someone help me out.

        -Russ
      • You missed XBox, surely the lamest possible name for a video game console.

        >I blame the rise of X near the end of
        >the internet bubble

        Yes I expect it was the sharp corners on the 'X' that burst the bubble. If only it had been an 'O' or a carefully oriented 'Q' instead none of this dot.bomb stuff would have happened and we'd all be snorting coke in the back of a limo as people flocked to our eCommerce B2B enabled portal eXperiences. Oops... there's that letter again.

        grib.
    • by e2d2 ( 115622 ) on Friday June 14, 2002 @12:06PM (#3702269)
      I agree that naming it extreme programming might not have been the best choice considering the images it conjurs up(picture Mountain Dew commercials with "narly d00ds" snowboarding yelling "Get Vertical!")

      BUT, that being said the XP name came from the fact that everything is done to the extreme. If testing is good then test everything. If integration helps find problems then integrate continuously. etc, etc.

      I say to any developer - take a look at XP. It's simply a set of industry proven techniques done to the extreme. It does work and even if you don't use everything you can still bring good practices to your coding from it. You don't have to accept any cult, take the red pill, or claim allegiance to xenu to take advantage of good techniques. If you don't like them or find they don't work then say so, but don't judge a book by it's cover (for lack of a more fitting cliche).
      • by Waffle Iron ( 339739 ) on Friday June 14, 2002 @02:46PM (#3703578)
        eXtreme Programming is yesterday's buzzword. The pendulum is swinging the other way, and the hot new fad is TM (Timid Programming). Here's an example from my upcoming tutorial:

        // import java.util.*;
        // TODO (6/5/02): Is it really a good idea to import the whole
        // package? Needs research

        // TODO (6/8/02): Maybe consider using a different language altogether.

        // public class XXX {
        // TODO (6/12/02): What is best main class name?
        // TODO (6/13/02): consider putting opening braces on their own line

        // public static void main(XXX) {
        // TODO (6/25/02): are the standard parameter names ok?
        // TODO (6/30/02): need to design implementation here
        // }
        // }

        // TODO (7/11/02): Not sure I understand the project requirements at all.
        // Need to have an all-hands meeting to discuss the preferred
        // word processor template because I'm thinking of writing a
        // white paper before I do any more coding here.

        // TODO (7/27/02): This program is stressing me out too much. I'm going to
        // leave early today to see my gastroenterologist about my nervous
        // stomach. Maybe I'll resign one day soon, but I'm not sure if
        // that's the best decision.
    • by The Pim ( 140414 ) on Friday June 14, 2002 @01:25PM (#3702950)
      I've gotten used to holding my tongue, but since you started it, I'll put my rant under yours. :-)

      I've used Ant, and concluded that it's only strength is that it comes with a bunch of modules ready-to-use. (Never mind that most of those modules would be five lines in a more modular, flexible system like make.) Further, in several respects, it has several serious regressions compared to other build systems. In light of this, it seems to me that the main reason Ant is popular is that it attempts to cover for the deficiencies of common Java compilers. What a mess!

      The first regression is that Ant (by default) doesn't do reliable rebuilds. The most basic function of a build system is to produce correct output, and Ant doesn't do it! Its default algorithm for rebuilding is to compile only those source files that are newer than their corresponding class files. So, for example, if you change an interface, Ant won't recompile all the classes that implement the interface. You won't know that they are broken until you (or someone else) tries a full rebuild.

      Ant has a "depend" task that attempts to fix this, by tracking source dependencies. Unfortunately, because most Java compilers don't do their part, Ant has to do this in an utterly kludgy way--by parsing class files! Not only is this slow and has some weird side-effects, it's still not completely reliable: Only the compiler really knows what files depend on what others. (For example, if it in-lines a constant, this may not be evident in the class file.) However, as far as I know, gcc is the only Java compiler that can output correct dependencies (jikes claims to do it, but is broken). Even if your compiler does output dependencies, you can't easily use them with Ant, because it stores its dependencies in a non-standard format.

      Another regression is that in Ant, individual source and class files are not first-class objects to the build system. You can't easily depend on, or ask to rebuild, a single class file. It's all or nothing. This too is largely due to compiler deficiencies: There is no way to tell most compilers to compile only the given sources; they insist upon compiling everything they think is out-of-date (again, gcc is an exception). This misfeature takes control out of the build system's hands, with the result that "recompile everything that's out-of-date" is the only feasible approach. Another effect is that parallel and distributed builds cannot be done reliably.

      Not to mention,

      The organic growth and dynamic flexibility shows how close Java can be to Lisp.
      I don't even know where to start on that one. All Ant shows is that if you give people a half-working workaround for broken tools, they'll flock to it.
      • Ant won not because it's better but because it offers users benefits that make doesn't. It is evaluated using different "metrics" than make. It's an example of the Innovators Dilemma in action. If you're interested I have some further thoughts about this at http://www.zanthan.com/itymbi/archives/000037.html (Ant and Innovators Dilemma) if you're interested. I'd welcome any comments about this "analysis" and pointers to flaws etc.
        • I replied on your site, but I'll repeat it here:

          What can I say, except that I suspect you're exactly right. Particularly, I had forgotten about the cross-platform part of Ant's appeal (I won't touch a Windows without Cygwin, but it's no doubt a hurdle for Windows natives), which I suspect is the biggest factor.

      • I'd defend ant as it does a good job of compensating for deficiences in the compilers. Depends does a lot, and is even better in ant1.5. No, we dont work with compilers yet, because there is no 'standard format' to work with; give us an XML one in jikes and javac and we will play.

        The issue with compiling more files than you ask for? That's javac or jikes for you; they pull in things they need, whether you ask for them or not.

        Finally, you need to play with cruise control or ant hill. Have something on the net do clean builds and tests for you instead of you doing it yourself.

        -steve

        Yes I do work on ant :)
  • Java already met XP (Score:3, Informative)

    by EatAtJoes ( 102729 ) on Friday June 14, 2002 @11:57AM (#3702189) Homepage
    ... in Martin Fowlers classic 'Refactoring', which uses only Java code examples.

    Java and XP are a natural combination anyway, since a lot of the emphasis of XP is to fixing crappy code. Since lots of Java code is written by your standard junior-to-mid-level Java programmer (usually an ex-VB or ex-ASP flunkie), it usually needs a lot of re-writing (oops, "refactoring"!).

    That being said, I don't see how a build tool is related to a programming methodology. Is it because it has a fairly standard JUnit task? You could easily get make to do that.

    Besides, reading a book now about Ant is foolish, because (hope, hope) Ant 2 will be available soon, which hopefully fixes Ant's more egregious kludges and bugs.

    • [...] since a lot of the emphasis of XP is to fixing crappy code.

      Surely the emphasis of most XP practices is to avoid ever writing that crappy code? That's what the evolutionary sort of development model it advocates is all about.

      In fact, I can see some would even argue that XP hinders fixing crappy code (reasoning on request, but I'm not going to feed the trolls uninvited :-)). Then again, since you're not supposed to get that far in the first place, whether that's a liability or not is a moot point.

  • by Anonymous Coward
    imp0rn Xtreme.J4va.COAD;
    Clazz JazzyJava {
    pubic voyd maine(Strig wordup) {
    while(jav4_is_still_Xtream)
    System.printl("you betta believe it sukka")
    }
    }
  • by Lumpish Scholar ( 17107 ) on Friday June 14, 2002 @12:12PM (#3702317) Homepage Journal
    The Extreme Programming movement came largely from the Smalltalk community, right about the time that community faced up to the face that VB and Java had pretty much cornered their former market. Java may have syntax like C++, but its semantics are surprisingly close to Smalltalk's; the migration started long ago. Most Extreme Programming projects (and books) are Java-based these days. (This crowd's second most common language is probably Ruby.)
  • Refactoring (Score:5, Insightful)

    by wormbin ( 537051 ) on Friday June 14, 2002 @12:14PM (#3702335)

    Extreme Programming consists of a lot of distinct ideas including: small teams, two people per keyboard, unit testing, and refactoring.

    The most useful of these ideas to me is refactoring. (probably followed closely by unit testing) Refactoring starts with the humble admission that at the start of most software projects, you really don't know exactly what the final product will look like. This implies that the design of the project will change during development. Refactoring is a set of techniques that allows the design of a program to change without making a mess of the code.

    If you are interested in Java and Refactoring, you really owe it to yourself to check out Refactoring [amazon.com] by Martin Fowler. He has come up with a very well written book in the format of Design Patterns [amazon.com] that does a good job of enumerating and explaining many refactoring techniques.

    • Two people per keyboard shairing one chair... Good combination for a bugless code. I have a bit of experience like this. There always came out something aukward as a result. But one can always try to enjoy the eXtreme!
    • Extreme Programming consists of a lot of distinct ideas including: small teams, two people per keyboard, unit testing, and refactoring.

      I disagree. None of those things was even slightly new in XP, and while we used all of them several times a day at my last job, we were hardly an XP shop.

      What is new is the way in which XP advocates using them. Everyone smart writes detailed unit tests, but not everyone writes them first.

      • He didn't say they were new. He just said that XP "consists of a lot of distinct ideas." Where do you read the word "new" in that sentence?

        • Nor did I say he did. However, as you point out yourself, he said that XP consisted of various ideas. My point was that since it didn't invent any of them, and all of them are widely used elsewhere as well, there must be more to XP than that.

  • The biggest problem is that testing a piece of code is guaranteed to be fairly rudimentary. No programmer can come up with test cases to push all of buttons in all possible combinations.
    No amount of exhaustive testing can cover all possibilities. On the other hand, people who use xUnit (JUnit, CppUnit, etc.) believe they can test all the piece parts. The pieces may not work together; but they surely won't work together if the individual pieces don't work right!

    More than that, there's a belief (justified or otherwise; I've got an open mind and want to get some experience before I take a stand) that xUnit allows the programmers to write the tests before writing the code, and that this "test first development" or "test driven development" leads to well designed code. (Kernighan and Pike suggest something similar in The Practice of Programming, but don't take it that far.) Interesting idea, at the very least.
    • It is high time to recal an idea to prove that the program is correct instead of testing it. For short peices of code it used to help a lot.
      • For anything more than short bits of code it's almost impossible to prove anything useful, and certainly impossible to communicate your proof in a way useful to someone who has to maintain your code.

        As Knuth himself said, "Be careful about using the following code -- I've only proven that it works, I haven't tested it."

        -Billy
    • I've done test-first. I'll never go back, no matter what other practices I'm using. It's just SO much easier to use my tests as my ally rather than my enemy!

      Tests are easy to write, and writing them helps clarify the requirements and design. Once they're written, the actual code often just falls out as obvious; even when it doesn't and I have to work for it, the tests are still a win because they tell me, automatically, when I'm finished coding: as soon as the tests all pass I'm done.

      I don't use xUnit, though, because I'm using C and C++. xUnit is available for them, but it's really an inappropriate model for static languages. I wrote my own testassert package, and my friend wrote a little Python script to build a test "main()" file by scanning a bunch of files containing tests. Together they serve me very well (in fact, they're published on Sourceforge under the name of CUT, with a new version due any time).

      -Billy
  • by smartin ( 942 ) on Friday June 14, 2002 @02:05PM (#3703295)
    I like many of the concepts of XP because it is a more realistic model of how developers actually work. The big problem however is that it does not account for programmer laziness and time constraints. One of the premises of XP is that you should develop objects for your current needs today. If tommorrow or next week, those objects nolonger suit your needs, refactor them until they do. In real life many/most programmers are too lazy or don't have time to refactor a class and then work through the code base to insure that every thing still works. Yes i know there are tools and the unit tests help. But the fact is most programmers will just write new code rather than rework existing stuff, especially if someone else wrote the original.

    The other big problem with XP is the working in pairs bit. Most developers smell bad, who wants to be stuck in a cubie with one.
    • Even though you'll probably be flamed, I wanted to throw my agreement in here. Most developers DO smell bad. I know it sounds like an unfair generalization, but in my experience it's true.

      HEY! there's something to be said for personal hygiene, people. TAKE A SHOWER!!! Please, I beg of you!

    • by dubl-u ( 51156 ) <<ot.atop> <ta> <2107893252>> on Friday June 14, 2002 @08:36PM (#3705506)
      The big problem however is that it does not account for programmer laziness and time constraints.

      Larry Wall tells us that the three cardinal virtues of programmers are laziness, impatience, and hubris. It would be a shame to work with a methodology that doesn't support those virtues. Happily, I am a lazy man, and I love XP. The problem you describe isn't one of laziness; it's with short-term thinking and a lack of discipline.

      If your tests are good, refactoring's pretty easy; you make the change you like and let your tests tell you if you've screwed anything up. (But it helps if you use an IDE with refactoring support like IntelliJ's IDEA [intellij.com]; that takes care of all the donkey work.) If your tests aren't good, then you weren't disciplined in writing them.

      If you keep things refactored and your tests are good, then adding new features is easy and low-pain. If you let your design rot and your tests don't cover anything, then adding new features takes a long time and hurts a lot. The truly lazy man will thus take the first path.

      Think of it like cleaning the kitchen. The short-term lazy person will dash in, cook a meal, and leave the pans just sitting around. Next time he cooks a meal, the pans are all crusty, so it takes a long time to clean them. The master of laziness washes the dishes right away, as that is the path of minimum work.

      Of course, this long-term laziness can be hard to acquire, but things like pair programming, a close team environment, and short iterations help a lot. If your partner notices your laziness right away or a team member will deal with your code next week, you're much, much less likely to write crappy code.
      • I absolutely agree that the key to refactoring is good unit tests. XP is an excellent idea. But i still maintain that it is hard to implement unless your group fully embraces it. I introduced a unit test framework to my group 6 months ago and even convinced the powers that be to invest in JTest. Today there is only one developer that has ever written a unit test .. me.
        • But i still maintain that it is hard to implement unless your group fully embraces it.

          That's very true. But don't give up! It's slow getting people stated with unit tests, but once people have had a little experience with it, they see how helpful it is. Once it catches on a little, the process will snowball.

          Some of my favorite tricks:
          • Run the tests automatically. Use a tool like CruiseControl or Anthill to automatically do builds and run tests. Then if somebody breaks the tests, it's not you who bugs them; it just happens automatically. It also gives managers a window into the state of the project, which they will like a lot.
          • Generate test coverage numbers. Use an automated tool to figure out the percentage of code covered by your testing suite. Collect this number and make it visible on a pretty graph, so that everybody knows whether test coverage is improving.
          • Require a unit test for every bug fix. It's hard to keep managers involved in every check-in, but they often track bugs. Get a policy that every fixed bug must have a unit test written before it is fixed. Programmers will often imply that they are too smart or too good to need to write unit tests, but once a bug crops up, that's a harder argument to make.

          Whatever people think about XP, good unit tests make for better code and less developer stress. Until I tried XP and test-first, I never really wrote them, but now they make my life so much easier.
    • Sometimes code REQURES a rewrite, or it's quicker to do so. In these cases, a rewrite is CERTAINLY meritted, rather than bashing your head against a wall trying to get code to do something it was never intended to do.
  • There is really nothing particularly "extreme" about "extreme programming". People have used the technique for decades. But in the 1990's, a lot of people made a name for themselves by giving new names to decades-old techniques ("generic programming", "patterns", "anti-patterns", "extreme programming", to name just a few).

    There is some benefit to the naming and the book writing that surrounds it: more programmers get exposed to the ideas. But don't expect a magic bullet: people have had a lot more experience with those techniques than their recent new clothes suggest. For some problems and environment, they work well, for others they don't. Talk to experienced programmers from the 1980's for more advice :-)

    • There is really nothing particularly "extreme" about "extreme programming". People have used the technique for decades.

      That seems wrong in a few ways.

      First, although I hate the name, it is quite "extreme". In my experience, compared with teams in the same industries, XP teams are extreme in: number of tests, test coverage, frequency of code changes, frequency of design changes, speed of response to requirements changes, amount of time spent coding (vs in meetings), amount of documentation, and bug counts.

      The practices also avocate certain sorts of extreme behavior, including testing everything, YAGNI, continuously changing your design, aggressively polishing your code, always programming in pairs, always telling your customers the truth, never accepting a deadline that you don't have good evidence you can't meet, and always going home on time. These aren't extreme just in their pursuit of "always" and "never", but also in that many people consider them either impossible or heretical.

      Certainly, there's nothing new under the sun. And many of these techniques were invented decades ago. But some of the techniques seem to be genuinely new, or at least not written about before XP. But even if these were all old techniques, the way they are put together is fundamentally different. They reinforce one another in ways that are crucial. If you try doing refactoring without doing unit tests, you will be screwed. Pair programming provides a lot of the cohesion that make things like common code ownership, minimal documentation, and aggressive refactoring work in a team environment.

      Agile methods like XP are also fundamentally different than the waterfall-derived models in their pursuit of short-cycle, high-feedback iteration. They also strive to create a balance between chaos and rigidity; most other development processes only push in the direction of rigidity. (For why this is important, see something like the book Complexity [amazon.com].)

      But don't expect a magic bullet

      Amen!

      People looking for magic bullets don't have the discipline to pull off XP. There are no quick fixes; the construction of good software requires skill, discipline, and patience no matter what method you use to build it. The method you pick can't provide those qualities; at best, it can reduce the chaos enough for you to improve them.
      • compared with teams in the same industries, XP teams are extreme in: number of tests, test coverage, frequency of code changes, frequency of design changes, speed of response to requirements changes, amount of time spent coding (vs in meetings), amount of documentation, and bug counts.

        Industry is not the only place where programming happens. In fact, industry is far behind the curve when it comes to new methodologies.

        XP is very close to the entire approach taken to programming by people in the Smalltalk and Lisp communities, practiced at least since the early 1980's in numerous academic and research labs.

Be sociable. Speak to the person next to you in the unemployment line tomorrow.

Working...