Some important points:
- Future of programming will be about “Control of (Side) Effects”
- Programming languages will become more functional than imperative
- Purity is good for understanding, verification, maintenance,
- Purity pays back in performance, parallelism, testing
- Functional/value-oriented is easier to test than object-oriented stateful
- Functional is good for generating tests (domain-specific language)
After a short intro into Haskell (10 min Haskell 101:)) SPJ moved onto testing in Haskell. In his demo, he tested a programme that would pack 7-bit words into 8-bits, so that eight ASCII characters would take up only 7 byte instead of 8. This sort of space saving is done in SMS where bandwith is precious.
One fundamental test tried to assert that
unpack(pack(x))==x. After testing some hand-written cases, which succeeded, the test started to use randomly generated words and started to fail after after a few hundred attempts. Due to its random nature, it took a randomly varying number of cases, but typically it failed after less than a 1000 cases. (It turned out that words of 8-byte length ending in a particular bit sequence were not correctly packed.)
The beauty of the underlying Haskell testing framework was that it took very few lines of code to express a generic testing framework.
The talk also showed that sometimes testing with large random test data is necessary to find bugs; something we rarely do!?
Overall, I found the speaker very engaging and the talk enjoyable even if I won’t claim of having understood or remembered everything.