Should Test-Driven Development be in the beginners tutorial?

Eric Winger eric at thewingers.net
Fri Sep 22 16:00:56 UTC 2006


Le Sep 21, 2006, à 11:09 PM, Matthew Fulmer a écrit :

>> <snip>



>> I like what you mentioned in an earlier email about building an
>> application as a framework for a tutorial. And I think that doing
>> test-first development is wonderful. Even if its just a couple simple
>> tests on the model for the gui (assuming you choose to put a gui on 
>> it)
>
> I am not sure what email you are referring to. Are you saying
> that you think it is a good idea to walk the reader through the
> development of a real application? If so, I assumed that this is
> the only way to structure the tutorial.  Do you have a different
> idea?

Nope. That's it.
>
> This paragraph is difficult to understand; could you restate it?

Unit tests are a great idea! (hope that's more clear, one should never 
write emails when they're tired) :)

>
>>> I do not know if my tutorial will target novice programmers or
>>> not.
>>>
>>
>> I would target novice programmers. Why not start there with a really
>> well-done intro tutorial that's up to date with the latest squeak dev
>> image and can be easily kept up to date?
>
> That is an interesting idea; I would write a tutorial for
> non-programmers completely differently than one for a
> programmer.

I was referring to novice squeakers (newbs). I should have been more 
clear.

>
> For a programmer, I would walk them through the environment,
> then have them write a transcript-based program along the lines
> of "Hello world", but a bit more functional. Then I would show
> them how to build a window (I am assuming it is similar to Java
> Swing or GTK) and make it display useful information.
>
> I am unsure how I could incorporate test-driven programming into
> that, as that is a *very* jarring concept to me, and hence to an
> average programmer.
>
>
> To target a non-programmer, I would take a completely different
> approach: I would first show them how to put a widget into the
> playfield, then how to manipulate it. I may or may not introduce
> eToys to the reader. I would never show them the Transcript; it
> seems useless when compared to Squeak's other debugging tools. I
> would then show them the ifTrue:ifFalse: and do: methods. I may
> introduce classes and inheritance; probably not. I am not sure
> how I would introduce them to windows and layouts.  Trying to
> think like a non-programmer is making my brain hurt :(

I'm not sure that writing a tutorial for a non-programmer is worth the 
effort, at least for now
I would stick with writing a tutorial for a "novice squeak programmer" 
first.
ie - someone who can barely open an image, but may be (or may not be)
quite proficient in another language.

>
> I don't see why I could not introduce test-driven programming to
> a non-programmer at her inception; it is the way normal people
> tend to think about problems. Normal people define a situation
> (test case) and then define how the object should behave in that
> situation.  Programmers are backwards: they tend to define what
> the object can do, then warp the situation to fit the object.
>
>
> I guess I need to choose which of three tutorials to write:
>
> 1. Programmer-targeted without test-driven programming (short)
>     This is the easiest of the tutorials to write, and may be
>     the one most in demand. Since I am in the same situation as
>     my audience, this would probably be the most realistic
>     tutorial.

I'm in favor of putting unit tests in the first tutorial. I don't think 
its that hard to do with a simple application and it shows benefit. For 
example, let's say the tutorial has this in it.

* Write a test to show what "foo" behavior should do.
*run the test, it fails.
* Write the method "foo"
* run the test, it passes! Yay!
* Now realize that foo is wrong and you have to change it.
* rewrite method "foo" to do the write thing
* run the test, it breaks.

This can immediately show the value of test driven development.

And I don't think that it's unreasonable to put that in the beginners 
tutorial.


>
> 2. Programmer-targeted with test-driven programming (medium)
>     This may be difficult to write, since it may be very
>     disorienting tutorial to the reader.



>
> 3. non-programmer targeted (long)
>     This would be the most interesting to write, and will be the
>     longest of the three choices. Writing this tutorial would be
>     a very direct measure of Squeak's ease of use: the length of
>     this tutorial should be inversely proportional to how
>     comprehensible Squeak is to normal folk. (a zero length
>     tutorial would be a perfect score by this metric)

Like I said, I think #3 should wait. The other is of more immediate 
value.

>
> Which would be the most useful? Do we need to make more than one
> tutorial? Please comment.
>
> -- 
> Matthew Fulmer
>




More information about the Squeak-dev mailing list