After about an hour and a half we were through variables and data types and most of the control flow statements. I did a quick reinforcement exercise after each concept, each of which used most of what we had previously covered.
The exercise we were up to was to print a set of 'lotto' numbers (6 random integers from 1 to 46 with no repeated numbers). Simple enough but you need to use an array for your results and progressively iterate over the array to avoid duplicates.
One of the kids started typing the moment it was clear what I wanted done. I gave them about five minutes to write it and then started walking round the terminals to check what they had done. It takes about another five minutes to do that because if anybody has a problem I can't prompt them through, I call everyone to stand around and help debug that code.
I then get to the second to last guy - they one who started first. He was still furiously typing. Then I see the scroll bar and line count - he is down to about page five.
He stopped typing about a minute after I arrived and said: "Sorry if this doesn't work - I haven't tried to compile yet".
Up comes a menu for a pay to play lottery system. The first menu has an owner and a customer screen. On the customer screen you get to buy one or more games, where either the computer picks a set or your submit your own numbers and you get told a payout. The management screen tells you the number of games played and the owner's current take in $ and lets you set a percentage return. The payouts are based on the probability of the result and that percentage.
This guy, having been introduced to programming for only 90 minutes, designs and writes a user friendly application with both user and management functionality, robust entry validation, using about five new statements we hadn't even looked at (from the help file), all in about ten minutes and the code compiles first time without error and runs perfectly. The 200+ lines of code was also clean, well structured and readable. The only problem was a few spelling mistakes in the prompts. I would have had trouble even typing 200 lines that fast without an error. He is 11.
My first thought was: "Oh no, maybe I have started an addiction to programming here and deprived the world of somebody who could have solved some real problems".
There were a few other jaw-dropping moments but none as good as that. One guy sat there for two minutes with his eyes closed while they were meant to be coding something to solve a Diophantine by an exhaustive search. He then typed for 10 seconds and said: "done". He had factored down to the three digit primes I had used to make sure there was only one solution. His program just printed that solution.
They have been mailing me since 8am (Sunday) with clever stuff they have done today. If I could give up my day job and work with those kids full time, I would do it in an instant. I can feel a plan for a Summer Camp coming on. Maybe we will write a simple game. Something multi-threaded and real time should stall them for a while.
Oh well, Monday is back to: "We don't care about referential integrity - it slows down data entry. Just write something to fix it up afterwards".
|< You are the salt of the earth | BBC White season: 'Rivers of Blood' >|