Thursday, November 19, 2009

Becoming a programmer - thinking algorithmically

[duped from a post i made on an industry only forum]

last time I taught someone how to think algorithmically I asked them... what is a seemingly simply task ... that you do ALL the time.

they chose - make a cup of tea.

I asked them to write down, in absolutely the order they would do it, everything they need in order to do it, everything they do to go from no cup of a fresh cup in hand.

each time they finished I asked them to follow their own instructions using only the inputs they specified, only the instructions they had written down....

took about 20 iterations to get it right but each time they got better.

I then asked them to repeat that process on their own with other simple tasks....

I did this before introducing any language or limits... simple english....

2 weeks later I sat in on them going through the same process for "checking & replying to email"... 100% correct.

after that... developing small programs in C became a syntactic problem only... write down the english as comments... flesh it out with the C.


sebh said...

Ah Ah!
I really like your idea. Every programming/development teachers should start from here with their students!

MIPS said...

Can you give me an example of a completed algorithm for making tea or at least what crucial steps were left out before it was deemed complete? Clearly you are not going down to the detail of what every cell in the body needs to be doing to grasp the tea-cup.

MIPS said...

I forgot to add that I do like your approach. Have you seen this paper?

Ultimately there is nothing satisfying and black and white with regard to predicting programming success (from the paper). You can say that programmers need to have a good and consistent model of how computers, registers and memory actually work.

Andy Firth said...

MIPS - this was a long time ago so i don't have any real examples tho from memory i can tell you that most people only went as far as the action the body would need to perform and not how those actions where carried out.

the assumption being that the body is the OS, tho i never really stressed that as a requirement.