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

2016 has been a good year

So much has happened over the last year with our Enterprise Architecture practice that it's hard to write a succinct summary.  For my day-to-day experience as enterprise architect, the biggest change is that I now have a team to work with.  This time last year, I was in the middle of a 12-month secondment to create the EA practice, working mainly on my own.  Now my post has been made permanent and I have recruited two members of staff to help meet the University's architectural needs.

I have spent a lot of the year meeting people, listening to their concerns and explaining how architecture can help them.  This communication remains vital, the absolute core of what we do and we will continue to meet people in this way.  We also talk to people in other Universities in order to learn from what they are doing and to share our own experience back.  A highlight in this regard was my trip to the USA last January.

Our biggest deliverable for the past year was the design of the data wa…

A new EA Repository

One of my goals since starting this job two years ago has always been to create a repository for architecture documents.  The idea is to have a central store where people can find information about the University's applications, data sources, business processes, and other architectural information.  This store will make it easier for us to explain our plans, to show the current state of the University's information systems, and to explain what Enterprise Architecture is all about.

It's taken a long time to reach this goal, mainly because we're often had more pressing and immediate work to be done.  The creation of a repository is one of those tasks that is very important but never quite urgent.  So I'm now very happy to say that we are in the process of deploying a repository and modelling tool.


This is the culmination of a careful process to select the most appropriate tool for our needs.  We began by organising several workshops to gather requirements from a rang…

New staff for the EA team

I'm delighted to welcome Jason Murphy, who joins us as our CRM Architect, and Wilbert Kraan, our new Data Architect.  Both Jason and Wilbert have worked as consultants for several years and bring new skills and considerable experience to IS.  They both know more than I do about their respective fields, which is how I like to hire people.

So the Enterprise Architecture practice now comprises the three of us, instead of me working on my won, which means we have more capacty to guide the University's IT architecture.  We can offer a greater range of skills and can bring a wider range of experience to bear.  I'm really excited about the opportunities this presents.

As his job title implies, Jason will focus on contact relationship management, working to build a user community and to create a strategy for managing and improving the University's relationships with prospective students, research partners, community organisations, and other parties - to give them all a better …