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

Changing Principles

In EA, architecture principles set a framework for making architectural decisions.  They help to establish a common understanding across different groups of stakeholders, and provide guidance for portfolios and projects.  Michael Durso of the LSE gave a good introduction to the idea in a webinar last week for the UCISA EA community.

Many organisations take the TOGAF architecture principles as a starting point.  These are based on the four architectural domains of TOGAF: business, information/data, applications, technology/infrastructure.  These principles tend to describe what should be done, e.g. re-use applications, buy in software rather than build it, keep data secure.  See for example the principles adopted at Plymouth University and the University of Birmingham.

Recently though, I encountered a different way of looking at principles.  The user experience design community tend to focus more on how we should do things.  E.g. we should start with user needs, use iterative developm…

Why the UCISA Capability Model is useful

What do Universities do?

This may seem a strange question to ask and the answer may seem obvious.  Universities educate students and undertake research.  And perhaps they work with industrial partners and create spin-off companies of their worn.  And they may work with local communities, and affiliation bodies for certain degress, and they definitely report on their activities to government bodies such as HEFCE.  They provide student services and support.  The longeryou think about it, the more things you can think of that a University does.

In business, the things that an organisation does are called "capabilities", which is a slightly strange term.  I think it is linked to the HR idea of a combination of the CAPacity and ABILITY to do a task.  Whatever the name, it is a useful concept.  A capability is more basic than a process: a University may change the way it educates students but as long as it remains a University it will educate them one way or another.

A capability …

"No more us & them"

WonkHE recently posted an interesting opinion piece with the title Academics and Administrators: No more ‘us and them’. In that post, Paul Greatrix rebutted criticisms of professional services (administrative) staff in Universites from some academics. To illustrate his point, he quoted recent articles in which administrators were portrayed as a useless overhead on the key tasks at hand (teaching and research).

This flows both ways, as Greatrix himself points out. As Enterprise Architect, I work with Professional Services colleagues and I have heard some of them express opinions that clearly fail to understand the nature of academic work. Academics cannot be treated as if they were factory workers, churning out lectures on a treadmill.

I think these comments reveal a fundamental clash of ideas about how a University should work. Some people who come into management positions for other sectors tend to frame the University as a business, with students and research funders as customers t…