Skip to main content

An Aha moment: Tests and the importance of computer science education

On Wednesday evening, I had an “Aha!” moment when listening to Steve Freeman talk about Test-Driven Development: That’s not what we meant at the local branch of the BCS.   Apparently there has been a bit of backlash against TDD recently, with people complaining that their test suites are so big and fragile that they take more effort to maintain than the actual code does. Steve was explaining his approach to writing tests and how to avoid these pitfalls.

As part of his presentation, he advocated that tests should be written for interfaces not implementations, and in fact for protocols rather than interfaces.  He contrasted an example of good practice, using a combination of externally visible methods to test behaviour, with a poor example that used a backdoor to twiddle internal state.  He remarked that it was only when he started to write these sort of tests that he finally understood the oft-repeated mantra that logical models should be separated from the implementation.

This was my “Aha!” moment, as I realised why some people were finding TDD difficult.  When I first encountered TDD, I already knew enough about specifying behaviour to let me write meaningful tests.   I had several years’ experience of writing specifications using mathematical logic, and although you don’t use the actual language of mathematical logic to write tests, the mindset is very much applicable.

It seems to me that this is an example of the value of a computer science education.  I guess that if you learn how to program from a purely practical approach, you may not be exposed to the more formal aspects of computer science.  You might still learn how to write good tests, as there is material around written from a pragmatic perspective and you can work some things out for yourself, but it might be more a matter of chance.  I also wonder whether university courses are making the links between the theory and the skills that can be transferred to the less formal approaches that are used in practice.

The main lesson for me is an understanding of the help that people may need when they are learning to write tests for the first time, or to create larger, maintainable test suites.

Comments

Popular posts from this blog

Webinar: Powering your business with Cloud Computing

On October 14th, I will be hosting a Grid Computing Now! web seminar on the topic of Cloud Computing. We have lined up two very interesting speakers who are using Cloud now to make businesses work. Ross Cooney had a good technological solution to sell but couldn't make it economic until Cloud Computing allowed him to pay for his computation only when he needed it. He will discuss the instant benefits and long term impact of cloud computing to the development, competitiveness and scalability of your application. Alan Williamson created the BlueDragon Java CFML runtime engine that powers MySpace.com. He advises several businesses and will give an overview of the different types of services available and how to avoid being locked-in to a single supplier. You can register for this event here .

Technology Strategy Board: Information Day, 22nd October

I've been asked to publicise the following event. The Technology Strategy Board has arranged an Information Day for Wednesday 22nd October to outline the various R & D Competitions being planned over the next 9 months. This Information Day will provide delegates with an opportunity to find out about the activities of the Technology Strategy Board and gain an understanding of the application process for Collaborative R&D Competitions as well as find out about other Technology Strategy Board activities. The event, being held at the Hyatt Regency Hotel in Central Birmingham, will open at 09:30 for a 10:00 start and will close at approximately 16:30; a full agenda will be available shortly. To register for this event please click on the following link and complete the on-line registration form For more information on the Technology Strategy Board please visit their web site

Business Model Canvas

A Business Model Canvas is a tool for mapping the core functions and capabilities of an organisation.  Compared to the Core Diagrams that I described in an earlier post , the business model canvas attempts to present more aspects of the business, starting with the value proposition – a statement of what the organisation offers to its users (in the business world, to its customers).  It shows the activities and resources, as Core Diagrams do, but also shows user relationships & channels, and also benefits and costs.  I’m not aware of any universities that have used this tool but you can find examples from elsewhere on the web. We are considering business model canvases as a tool for mapping the strategic capabilities of units at the University of Edinburgh.  Phil Taylor, our EA contractor, sketched an outline of what a business model canvas might begin to look like for HR: This is only intended to be suggestive: the real canvas would need to result from in-depth discussions abo