Hacker News new | past | comments | ask | show | jobs | submit login

If only my bugs were as simple as the methods reverse, concat, and index...

Granted, to an extent, my bugs probably were as simple as that. But it was as likely an emergent simplicity. Not to mention that one of my laws will be performance.

This is like showing how awesome a language is with a to-do app. Neat. Possibly educational. Mostly an exercise in how well the author knew how to write a to-do app.




> If only my bugs were as simple as the methods reverse, concat, and index...

When I first read about QuickCheck, I had similar reaction.

But then I learned that QuickCheck can test stateful systems also. For example, this bug reported against LevelDB, a database system developed at Google, was discovered using QuickCheck: https://github.com/google/leveldb/issues/50. You can read more about it at http://htmlpreview.github.io/?https://raw.github.com/strange...


These links are awesome. More examples of real world successes go a long way to not just impressing with technical ability, but convincing of practical use.

That is quick check impresses me. I just haven't seen many real world examples of it providing significant value. And I no longer buy in to appealing arguments. :(



If only your core logic had some straightforward invariants...

QuickCheck can work effectively with complex data structures.

For an example of a simple invariant that can still uncover subtle and important bugs:

encode(decode(X)) = X

Where encode and decode are some domain specific blobs of protocol logic. It's pretty useful to have the computer verify that isomorphism with a huge number of generated inputs.

(There's also SmallCheck which is like QuickCheck but checking all possible values within some depth limit, instead of random values.)

And there's no reason you couldn't use QuickCheck to verify a performance law, by the way.


My complaint was less against quick check, and more against the examples. Pedagogically themed ideas make sense. Practical and visible results are better. By orders of magnitude.


> And there's no reason you couldn't use QuickCheck to verify a performance law, by the way.

In fact, I've done something similar to this.


I'd be interested in seeing how you did this.


More precisely what I did was minimization on an unusually slow example input, but I don't think I can share the code. The approach generalizes, though:

To verify performance, you would set it up to benchmark the code in question (in Haskell, this would probably mean using Criterion) and then assert that it was "fast enough" (probably relative to the size of the input).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: