THERE is a black and white photograph in the National Museum of Computing at Bletchley Park in Buckinghamshire of a pupil in his school blazer demonstrating an early Elliot 903 computer to the visiting minister of education.

The photograph is a testament to the extraordinary forward thinking of a mathematics teacher called Bill Broderick who persuaded the London borough of Havering to buy the UK's first school computer in 1965.

It is also an early hint of the impact that enlightened decision had on a young Tim O'Shea, who was a pupil at the Royal Liberty School, in Romford, where that computer was installed.

Now Professor Sir Tim O'Shea, principal of Edinburgh University after a distinguished career in computer science and university administration, he remembers with great fondness that pivotal moment.

"So this lovely computer came, but it arrived without any software so I worked out how to programme it in machine code. Then the school persuaded the University of London to put on a special A level in computer science and for my project I wrote a programme that could find its way around mazes," he reminisced.

"That teacher was very charismatic and it is still an amazing achievement to persuade a local authority to just give the school the money to buy a proper computer, but he gave them a vision that this was the thing of the future and if we were going to do mathematics properly we needed one.

"There was a lot of enthusiasm and he was the one who told me to start programming and that was the best bit of advice I received. It kept me going really. I used to mentally inhabit the computer."

The depiction of these types of life changing events as serendipitous occurrences is a recurring one as Sir Tim recalls his progress from talented student to renowned computer scientist and university leader, holding posts as master of Birkbeck College, pro-vice-chancellor of London University and the Open University before his current role. But if it is a career of happy accidents then it is also one where opportunities, once presented, have been grasped.

When he left school he looked at the undergraduate science curriculum available and felt there was little point in taking it because he "knew it all".

So he did an undergraduate mathematics and experimental psychology degree at Sussex University, working for IBM in the summer, and then progressed to a Phd in machine learning at Leeds University, which was then a relatively obscure form of artificial intelligence.

"I fancied doing something with computers after university and my friend was on a cross country run and met an academic from Leeds who had an unfilled Phd slot and my friend said to him he knew someone who was good with computers so I got a letter out of the blue from Leeds, got on the train and went," he said.

"I had never been north of Watford before, but it had the added advantage that I didn't have to wear a jacket and tie and it seemed like fun. People offered me jobs I wasn't expecting at different stages at my career and I accepted them if I thought they were interesting."

While working on his thesis at Leeds, Sir Tim established the computers there weren't big enough for him, but, again through a contact, got an invitation to go to the University of Texas at Austin, which had "very big" computers. It also provided a somewhat unlikely introduction to being a hippy.

"I had a fabulous time. I learnt to ride a horse Western style and I got very enthusiastic about progressive country and western music. I lived in a co-operative and it was very bohemian," said Sir Tim.

"There was sixty of us living in a southern "Gone With the Wind" style mansion with the pillars and all of that. It was self-governing and you voted on things and we were all very radical.

"What was interesting was that it was a very hippy wild place in those obvious ways such a place would be, but on the other hand it was a place with an extraordinary can do attitude.

"I was 23 then and it gave you the notion that you could just do stuff. You could stay up all night computer programming and if you didn't have a computer big enough then you could go over to physics and get the codes for the door because they had a bigger computer. You would just go and do things."

If today's Sir Tim, seated in a leather armchair in his spacious office overlooking the university's 19th century quadrangle, cuts an unlikely former hippy it seems an equally far cry from his humble beginnings.

Born in Hamburg in British-occupied Germany in 1949 to an Irish father and a German mother he grew up bilingual, but with little family emphasis on the importance of school. When is family moved to London a few years later he attended an Irish Catholic primary school - where he was scared of the nuns - and then Protestant grammar.

"My father was a volunteer in the British army in the Second World War and after the war he served in the Allied Control Council running the British sector of Germany," said Sir Tim.

"The Irish, if they wanted to, could marry Germans, so quite a lot of Irish German families originated from there. When the Control Council finished he came and worked on the London Underground selling tickets and my mother taught German."

Sir Tim remembers his father having excellent mental arithmetic and being promoted to the post of relief clerk, where he was trained for all the jobs on the London Underground and would wear a suit and tie and carry a silk bag with a stationmaster's hat inside.

"He would just be sent to the station which was most problematic and if he had to restore order on the platform or something he could turn himself into a station master by putting the hat on. He was paid extra, but it was a rotten job really because it meant typically he would be going to a station where people had called in sick and there were no staff."

Despite the fact he was clearly performing well at school there was no particular pressure to succeed academically or even a sense of what it might lead on to.

Because his father had left school at 12 he didn't have a view about school and because both his parents were "autonomous" in their mid teens they expected him to decide if he found school interesting or not.

"I have quite a vivid memory of walking down the street at the age of 16 and a neighbour said to me: "You're doing very well at school aren't you," because I had all these O' levels and the neighbour said: "You could go to university." And it hadn't occurred to me and it certainly hadn't occurred to my parents so it was quite a surprise when someone said that to me on the street."

One he left Austin University he was offered a number of jobs working first as a researcher at Edinburgh University and then after four years he took a permanent lectureship at the Open University and moved to Milton Keynes in 1978, spending 19 years there, climbing the managerial ladder as he went before being offered the top post at Edinburgh in 2002.

Sir Tim, who earns a salary of £227,000, is acutely aware of the debate around the perceived greed of university leaders, who earn well in excess of the Prime Minster, but he is unusual in that he has continued to refuse a pay rise over the past few years.

"I think I am well paid and I think I do a good job, but it has been my decision not to have a pay rise. I felt that at a time of economic austerity it was very difficult if my colleagues were not getting pay rises. Each year there has been a suggestion for a rise, but I have declined. It is the context. I wouldn't really be comfortable taking a pay rise if the majority of my colleagues were not."

Sir Tim also has interesting views on the current debate on university governance and the perceived interference of the Scottish Government. Although he is not as exercised as some of his fellow principals about the plans he has one critical message about autonomy.

"It took 40 years between Nobel Prize laureate Peter Higgs writing his prediction and it being found out to be the case, which has had an immense impact on the status of European science and Scottish science in the world," he said.

"If you were to ask a government minister in the late 1960s whether we should invest in Peter Higgs, but it might take 40 years, there is no way that would happen, but a university will have the confidence to look at the long game and to back the individual or give them protection. That is why autonomy matters."