Exercise 1A completed.

So I’ve just finished exercise 1A from A Discipline for Software Engineering.


Switching to more idiomatic Lua (see my last post) made a big difference in the subjective easiness of the work; but I still spent almost as much time in the Test phase as I did in the first design.

Nevertheless, the code now runs and passes the miniscule test suite based on the data in the book (Table D5). I wonder whether it would have been worth to write a fuller suite to cover the functions I put together — for example, the std_dev function is tested directly by the suite, but not the avg or sum functions.

I’ve also started putting my work online at Github. Pretty rudimentary stuff, but at least it gives me a motivation to do the exercises if I imagine that somebody is checking out the code & logs and going over them.

For testing I used the lunatest package. Missing from lunatest is a capability to provide precision deltas on the assert_equal function. In ADFSE, the standard deviations of the sample data are given to 2 decimal places and are rounded. Lua doesn’t have rounding built in, so it was necessary for me to include a little rounding function to equalise the results. Other testing frameworks I’ve seen allow you to pass in a delta value — a degree of permissible variance that still counts as “equal” — which saves a lot of the bother.

So that’s it. I’m looking forward to the next exercise.

This entry was posted in PSP. Bookmark the permalink.