Week 1 Quickcheck in Principles of Reactive Programming course on Coursera – 10.00 out of 10.00

I’m on the devoxx conference in Antwerp, Belgium. Too bad that the past couple of days I’ve been spending on Week 1’s Quickcheck assignment in the Principles of Reactive Programming course on Coursera. I simply couldn’t let it go past me without a solution that would give me the whole 10 points! I simply couldn’t.

So I was solving the exercise and the first and higest score was 8.33. Doh! How could that have happened?! I was doing my best and the second submission was nothing better – 8.33 again!

It took me some time reading here and there about ScalaCheck, watching the videos over and over again, just to find the opportunity to bump up the score. I wish I had been smarter, but it was merely this thread How many tests did you write for the assignment? where I found the inspiration. It worked out very well and the score ended up 10.00/10.

coursera-reactive-quickcheck-score

I remember the moment when I wrote a property and the tests went green. That made my day.

coursera-reactive-quickcheck-tests-greenAs it was just before the final time for the solution, I was a bit worried how much off the clock I am and whether or not the solution gets the score. It was 7 minutes to the due date.

It didn’t take long to see the final result – 10.00 out of 10.00 – that’s what I was looking forward to while doing the exercise.

coursera-reactive-quickcheck-score-feedbackTime to socialize! On to Devoxx…

 

Be Sociable, Share!
This entry was posted in Languages.

2 Responses to Week 1 Quickcheck in Principles of Reactive Programming course on Coursera – 10.00 out of 10.00

  1. Michal Karolik says:

    was the error connected with Binomial heap and some problem with empty heap?

    I didnt get through it.. so 8.33 here ; )

    • Hi Michal,

      That’s correct – Bogus4BinomialHeap – brought so much trouble. One I found the hint in the forum, I wrote a test with not much help of scalacheck – just a sequence of operations I should’ve thought before, but I didn’t. The point is to not read the source code of a tested class and only apply your thinking to the Heap contract – the trait Heap.

      Now I see that the point of the exercise was not only to learn scalacheck, but more importantly to see a value in testing a contract with many more tests than one could ever think of. I’m sold to the idea.

      Hint: notice what a given data structure (a trait, say Bogus4BinomialHeap) introduces (aka changes). Think about what the change on the contract (Heap). Since the trait changes how deleteMin works, spend your time on the laws that govern how this operation should behave for any heap. That should lead to an answer.

      Good luck!

      p.s. I’m creating a group on meetup so we can discuss potential approaches. Stay tuned for more (and ping me when no announcements reach your mailbox/eyes).

Leave a Reply

%d bloggers like this: