Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Teaching Java the Extreme Way
Subject:   Wwhy wouldn't you use JUnit?
Date:   2002-10-24 08:16:01
From:   iansloman
Daniel, why wouldn't you use JUnit for unit testing, especially since it already exists and would save having to write your own testing code?
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Daniel H. Steinberg photo Why wouldn't you use JUnit?
    2002-11-21 11:58:47  Daniel H. Steinberg | O'Reilly AuthorO'Reilly Blogger [View]

    Ian,



    That's a great question. I wanted to separate the idea of testing first from JUnit -- which I use every day and appreciate how it has improved the quality of my code. There are some people who feel that introducing the JUnit structure is a difficult way to begin a course. They feel that there's too much stuff that would need to be taught before the students are ready to begin.



    For the most part, I agree with you. I think you can start right off with JUnit. Here's why I didn't.


    In the first article I made a big fuss about what I didn't like about beginning with HelloWorld as a first program. I didn't want to turn around and say, "remember when I said not to teach them main(), and public, and static, and void, and arrays, and so on -- now teach your students TestCase and so on first."

    My hope was that this lesson taught students to create a simple class that contained a single method that was able to respond to a method call. The code that the student sees is very clean and the prompts they receive should be instructive and helpful.



    Thoughts?


    Thanks, Daniel