Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My daughter and my son are learning Java with BlueJ. I really don't understand why the first thing they learn isn't to write code to bring a testcase to green light.

share|improve this question

closed as not constructive by gnat, thorsten müller, BЈовић, GlenH7, MichaelT Apr 30 '13 at 11:57

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Would this not be the same… – Jeremy Oct 11 '10 at 14:24
Which school? What, specifically, are they teaching? What are the course expectations? What sorts of things are they expected to do as they progress further in the school? – David Thornley Oct 11 '10 at 16:39
What do you mean, "the first thing they learn?" Is this their first introduction to programming at all? If so, TDD has NO PLACE in that course whatsoever. Students need to grasp the fundamentals of programming before worrying about test cases. – Matt Olenik Oct 11 '10 at 16:47
I read the title as dangerously close to a religious flamewar starter (such as "Why doesn't everyone like just use OOP because it is like so obviously the best? Ohmigawd?"), but the body makes more sense. – Jon Purdy Oct 12 '10 at 0:16
TDD was part of my programming lessons at my school... – Rig Dec 8 '11 at 19:22
up vote 3 down vote accepted

I am taking a Java class that uses BlueJ right now. An assignment due tomorrow is to use JUnit, which come preinstalled into BlueJ, to utilize TTD methods to build a program. Every class I have taken so far encourages (if not requires) pair programming and Agile methodology, so I would say that schools actually do teach this, at least in some cases.

share|improve this answer
Good to know that JUnit is preinstalled with BlueJ. I think I have to talk with the teachers of my children. :-) – Heinz Z. Oct 25 '10 at 18:57

One reason is that TDD is seen as being new so it hasn't had chance to filter down to University or school programming courses.

There is a lot of bureaucracy involved in the design of academic courses and it will take a while for everyone involved to become familiar with TDD and see its value.

By the same token, would you expect physics students to be taught the latest string theory - particularly when there are still arguments and unknowns in the theory.

I've just thought of another reason - the course is teaching programming not software development. Things like TDD, source control etc. are to do with the practice of software development, not the art of programming. You need both in order to succeed, and perhaps they should be taught in parallel, but if the course is a programming one you might only get the programming aspect taught.

share|improve this answer
The design of the course don't need to change. They can give the kids a testcase only to check their work. – Heinz Z. Oct 11 '10 at 15:09
TDD has been around for around 10 years. The Kent Beck was published in 2002. Newness is not much of an excuse. – danio Oct 11 '10 at 15:17
@danio - I do say it's "seen" as being new. TDD has yet to penetrate to all areas of software development yet! – ChrisF Oct 11 '10 at 15:18
+1 for "programming not software development." Good point indeed. – Joonas Pulakka Oct 11 '10 at 15:56
I like to come on P.SE to read (and memorize) statements like that. Thanks ChrisF – user2567 Oct 11 '10 at 16:31

If the students don't know how to write code, how are they supposed to do a test first? This kind of makes me think that you'd want a student to write a summary of an essay without understanding sentence structure first. Not likely to work well, I'd think but maybe that is just my opinion on the matter.

share|improve this answer
+1, it has no place in an introductory programming course. – Matt Olenik Oct 11 '10 at 16:48
They don't have to write the tests by them self, they only have to bring them to green. – Heinz Z. Oct 14 '10 at 9:32
If they don't write the tests by themselves, then it is not TDD – David Oct 25 '10 at 7:30
@david: if it is not solving a real world problem, it's not programming, so you don't program in School. Imho, it's a sliding scale, and as a first step, having to meet someone else's tests would be a good idea. – keppla Aug 30 '11 at 10:38

My university gave me tests to check my work against (well, test cases in the "for input A, the output should be B" sense). That was enough to ensure the assignment ran correctly, considering the workload required to complete the assignment in the first place.

I think getting the concepts taught by the exercise is more important in school than spending time writing a test harness for it.

Now, whether or not there should be an additional "real world application development" course is a different matter. Such a course could teach TDD, agile, waterfall, etc.

share|improve this answer
This is a good point. They are teaching the fundamentals of programming, not the fundamentals of developing. – ChrisF Oct 11 '10 at 15:20

The question betrays a misunderstanding of the purpose of university.

The broad goal of university is to educate the attendees in a wide variety of subjects and to pursue research enriching the world around it.

Computer science is a study of algorithms and data representation, the physical devices used to represent same, and the mathematics underlying same.

The general tool is programming. A tool for larger-scale programs is TDD, which requires fairly specialized knowledge to get running and to write tests against. Most universities I've read curricula from require a course in software engineering, which is an exposure to larger-scale software development ideas.

Many universities seem to have automated assignment submission. Except since professors weren't in style enough to call it "TDD" and have green pixels light up, they didn't.

And how in the world are beginners going to write a test when they struggle to figure out how to write basic control structures?

share|improve this answer

I was submitting assignments back in 1990 against automated tests - long before 'unit testing' as such existed as a term in the sense that we now mean it.

I think the problem is that unit tests really come into their own when you don't have a clear idea about the requirements or when those requirements change. This is rarely, if ever, a problem for university assignments so they maybe don't appear that relevant in an academic setting and hence aren't taught (of course those of us doing unit testing know better...maybe... :-) )

share|improve this answer

I think that TDD's many benefits wouldn't be demonstrable in the context of school assignments. Without demonstration, students (even professionals new to TDD) would fail to see these benefits.

One purpose (among others) of TDD is to ensure that future changes to the code don't break existing functionality. School assignments are usually standalone - there being no relationship between assignments - so this benefit wouldn't be apparent

Even if we look at other benefits - that TDD helps in defining a clearcut API for your classes - I'm not sure how relevant this would be to school assignments - where the focus is more on the logic and getting it done than on elegant code and reusability.

share|improve this answer

Most people in academic circles haven't spent much time outside of it. My guess is most professors simply lack the practical experience to know the value of TDD.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.