Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIT 6.005 Software Construction: Test-First Programming #94

Open
YvesMuyaBenda opened this issue Jun 27, 2017 · 5 comments
Open

MIT 6.005 Software Construction: Test-First Programming #94

YvesMuyaBenda opened this issue Jun 27, 2017 · 5 comments

Comments

@YvesMuyaBenda
Copy link

YvesMuyaBenda commented Jun 27, 2017

Though the course uses Java, generally useful discussion on testing within the larger context of writing a specification, and thinking of properties: Test-First Programming. The material gives a wider context within which to understand the specific coin-changing example being used, in that, though the tutorial is very careful to speak about the specification--requirements by any other name will still be requirements--the tutorial spends less time discussing how tests cases are chosen, with the same non-discussion of choosing test cases in the Elm-Architecture in Javascript piece, where the simplicity of the functions obscures what choice is being made in the test cases: my basic understanding is that the partitioning should follow from first the specification, and then the general properties of the functions being described, but most discussion of testing does not tend to discuss general properties at all.

@kfern
Copy link
Contributor

kfern commented Jul 17, 2017

Hi @YvesMuyaBenda

For a beginner level I think it is not convenient to use a different technology like Java. It can disorient those who are following the manual.

@nelsonic
Copy link
Member

nelsonic commented Jul 17, 2017

@YvesMuyaBenda agree with @kfern, when I started writing tests back in '09 the only tutorials were in Java and they were needlessly complex (to be expected with a class-based language) 😉
We should expand our Testing Tutorial with a practical test-first project. (we just need time!)

@YvesMuyaBenda
Copy link
Author

YvesMuyaBenda commented Jul 17, 2017

@nelsonic @kfern Yes, Java is a rather cumbersome langauge, with cumbersom tools, yes? My point in supplying the link was not to suggest that folk beginning in Javascript jump into the complexities of Java (that would be a needless time wasting diversion consuming large resources of time and energy and mental space), what I was referring to in the examples was the very clear discussion on testing which links thoughts of the relationship between specification and testing, testing and general properties, testing strategy, and the cleanest discussion I have seen about how to create example based tests based upon partitioning the set of input values, among other things.

All of this can be abstracted into the context of Javascript, since these are general principles, as in, in choosing the test cases, what is the choice based upon? Now, these are all extra thoughts, the first step would be to be able to think of any examples whatsoever. Likewise, with the link on the Python podcast, I was not suggesting that the beginning Javascripter take a diversion into Python. It is just that some of the best materials explaining aspects of testing are not (in my limited experience) written in Javascript.

For example, from my point of view, in F&C folk are suggested to learn to do random testing in Codewars without having seen the wider context of property-based testing, which is most clearly discussed within the functional programming community An introduction to property based testing. From where I stand right now (and admittely I speak from my own point of view and limited experience), that would amount to rolling your own proprety based-testing framework from scratch problem by problem without the wider context, by ad-hoc creating generators that create random values that conform to the types of the inputs to your function without any of the thinking tools that have been created.

For myself, I seek the best explanations first, for example the basic question of TDD was written in the framework of learning Ruby, and so eventually what seems to be happening is that all programming langauges are beginning to look like different types of pseudocode, since I am abstracting all the time.

To summarise, it was the principles discussed in that discussion of testing within Java that I thought would be useful, not the Java language itself. Which is why I would never put the link within resources based on raw beginners who started with Javascript, since I would not expect them to know of or be able to abstract general principels apart from the langauge in which a tutorial is written.

Of course, I defer to the wider community's wishes, and am happy to go along with what is decided. I appreciate the effort that it took to create DWYL.

@newswim
Copy link

newswim commented Jul 17, 2017

There is at least one PBT library in JS that I'm aware of - https://github.com/jsverify/jsverify

A lot of the ideas come from Haskell's QuickCheck, which is extremely interesting in its own right...

screen shot 2017-07-17 at 5 22 01 pm

See: YouTube Link

Also, AFAIK the test framework most often used in Elm works similarly, but they call it Fuzz Testing.

@YvesMuyaBenda
Copy link
Author

YvesMuyaBenda commented Jul 18, 2017

@newswim The best documented QuickCheck derivative that I know of is ScalaCheck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants