logoalt Hacker News

mrkeentoday at 9:27 AM1 replyview on HN

Unit testing:

Well, which is it? Testing a function, a class, or a module?

I didn't give my definitions of testing. I said when you go out into the OO worldview, different people will call it different things, so ignore it, it's not important. Sometimes one person will call it two or three different things. E.g. Unit testing is a function testing vs. unit testing is class testing.

Demeter: That's the thing I called wishful thinking.

Encoding desired sequence of behaviors into a type doesn't prevent errors: That's the value proposition of Choreographic programming. If it's wrong from the outset, simply disregard it.


Replies

crabbonetoday at 11:43 AM

In order for you to understand what a "unit" is, you need to first consider that there are different languages with different units. The definition of a "unit" doesn't give you a concrete size, it gives you a size relative to the language or even the project you are working on. It will be something the programmers working on the project will have to agree on, when they set to design unit tests.

Other examples of relative units: pixel (they don't have a fixed size in software), portion (as in cooking: it will depend on the place the food is served, intended audience), decibels (they don't measure the absolute volume of sound, they measure how one volume corresponds to another).

But... who am I kidding? If you were intelligent enough to understand the subject of this thread, you were certainly intelligent enough to understand what a "unit" is in unit testing. You are not arguing in good faith.

> Sometimes one person will call it two or three different

This is poor ability to reason: if two people disagree it doesn't follow that everyone is right.

> If it's wrong from the outset, simply disregard it.

This is poor ability to reason: criticism of a concept is just as valid of a way to discuss the subject as is praise. Nobody should be told not to discuss the subject if they think the subject is defective.

> Demeter: That's the thing I called wishful thinking.

While providing no arguments and no evidence.