Becoming an expert?

12 Jan, 2018

Femi A writes:

I just got your book: Python for kids and I’m excited to start reading it. I am 36 years old and I would like to learn computer programming. I figure python would be a good place to start. Is it possible to become an expert at python in 6 months with intensive efforts? And if it is can you please let me know how to go about that, the steps to take etc...

I would say this isn't necessarily a Python, nor even a general computer programming question. It's more a question about how you define expertise, what that means from a learning perspective, and what your goals really are. If you define expertise in terms of Malcolm Gladwell's 10,000 hour rule and spend 4-5 hours a day at it, you'll be an "expert" in 6 years or so [1]. So if your goal is to call yourself an "expert", then that's probably your timeline.

If your goal is to develop some software, make a meaningful contribution to an open source project, or something along those lines, and are well motivated, it's certainly possible to do that, and more, with 6 months of dedicated effort. So, how to get to the point where you're at least confident in your coding? Start with a beginners book, funnel that knowledge in developing a few simple projects to build your experience; then perhaps look for a more advanced Python book (O'Reilly's Python Cookbook might be a good option), followed by some more advanced projects, again for the experience. Just remember, it's more important to be coding than reading about it.

Hope that helps.

[1]: Also see this Business Insider article for a counterpoint to the 10K hour principle.

Python for Kids on the Raspberry Pi

10 Jan, 2013

I finally managed to find enough bits-and-pieces to get a Raspberry Pi (borrowed from a friend - thanks Matt!) up and running, in order to test out the code from Python for Kids. A USB charger for an old Nokia phone, a somewhat dodgy-looking USB power adaptor from the bottom of a cobweb-filled box in the back room, a wireless mouse (the base for which had managed to hide itself on the opposite side of the house), a bent network cable (surprisingly still functional), and a powerline adaptor scavenged from the TV. In the end the only thing missing was a USB keyboard, which finally arrived in the mail this morning.

Raspbian menu It looks like all the code works fine, and Python3 is installed by default on the Raspbian operating system, so there's not a lot required to install out of the box. There is one thing to be aware of - do not use the IDLE3 icon which is on the desktop by default (at least not when you're running the graphics code in the book). Instead, go to the Other menu, and choose IDLE (Python 3.2) (click on the screenshot to see what you should be looking for). This runs IDLE in "No subprocess" mode, so modules such as turtle will run correctly.

However, to use GIMP (the graphics program we use in Chapter 15), you will need to install it first:

  1. Make sure your Raspberry Pi is connected to the internet
  2. Open a terminal (select the Other menu, and then LXTerminal)
  3. Update the package list (might not be necessary, but just in case) by entering the following command: sudo apt-get update
  4. Once completed, install GIMP by running this command: sudo apt-get install gimp

After installation, you'll find a new menu option in the Graphics menu: GNU Image Manipulation Program.

That should be all you need to get started with the Raspberry Pi.

The Front Page

31 Jan, 2013 Very cool. The front page of

Officially geeked out.

Puzzle 1 Solution

01 Jan, 2013

Happy New Year!

The solution to Programming Puzzle 1 has been added to the puzzle page - actually it was updated just before Christmas, but I've been entirely too lazy busy to post about it. ツ

Puzzles 2 and 3

21 Jan, 2013

The solution to Programming Puzzle 2 has just been added to the puzzle's page, and challenge number 3 has been posted.

Stickman Elevators

25 Jan, 2013

Henry Angeles writes:

I'm not a programmer, so when my kid asked me to make an elevator in the stickman game I totally failed. I can get the platform to move up and down, but when the elevator starts going up with the stickman on it, hilarity ensues.

I guess at the end of the day i'm asking how this can be done. Thanks for your time.

I'm not surprised you found it difficult. It caused a fair amount of head scratching until I realised the trick to getting this working. If you used the code for the horizontal platforms in PythonForKidsSolutions.pdf as the basis for your elevator, your stick figure probably slips through the platform as soon as he touches it (or potentially rockets off up the screen depending upon your code). The elevator moves at a different speed to the stick figure, so you need to match that speed when the figure lands on the platform - and you can't rely on the basic collision detection code as it's written in that example.

A new programming puzzle, for this, has been added to the puzzles page - check back in a week or two for the full solution.

Puzzle Updates

12 Feb, 2013

The solution to Programming Puzzle #4 has been posted, and you can also find a new puzzle added here.

Programmer Humour

13 Mar, 2013

Thanks very much, Randall...

ineffective sorts made me laugh out loud on the train, so now I look like a nutball. ツ


17 Mar, 2013

About the only thing I actually use Google Reader for, is synchronisation between devices. I use both Net News Wire and Feeddler -- neither of which are perfect, but the magazine-style RSS readers (such as Feedly, and the like) don't really suit my usage patterns.

I wonder if the answer (for myself, at least) is a basic web-based reader, which uses dropbox for storing synchronisation data. With about 5MB of localStorage, I could also possibly fix one of my bug bears with the clients I use at the moment - offline download of some content (for those train trips where the connection drops like a yoyo). Using the iPhone's safari browser for the reader itself would fix the other problem I have (specifically with NNW) -- poor download and page rendering performance.

There's my spec ↑... now I just need to find the time to develop it... (before July)



08 Mar, 2013

Rather belatedly... the solution to Puzzle #5 was posted a few days ago. Puzzle #6 is now also available.

Also rather belatedly, Dave Winer has an interesting take on the recent promotional video. Stand out quote:

Primarily you should do it (ed: programming) because you love it, because it's fun -- because it's wonderful to create machines with your mind. Hugely empowering. Emotionally gratifying. Software is math-in-motion. It's a miracle of the mind. And if you can do it, really well, there's absolutely nothing like it.

Scratch or Python?

24 Jun, 2013

Marvin writes:

I have a 10 year old son who is interested in programming. He really loves playing games so I thought he should learn how they are created. I am a bit confused on which language to have him start.

My question is should he start with Scratch (and for how long?) or should I start him with the Python language (with your book)? I've also heard about Ruby for Kids. Which is the easier path for him to start.?

I will greatly appreciate you thoughts on how he should get started?

Well, by all means, my book... ツ

But to be entirely honest, it's a difficult question to answer. Some kids will find the visual nature of Scratch attractive. And it may be a natural progression to go from something like Scratch to a more traditional programming language (not something I have a lot of experience with, given I started with a traditional programming language when I was a kid). But, if he has a modicum of technical ability, and an interest in how games are really created, then learning a traditional programming language may be the better path.

Either way, I don't think it will do any harm to start with Scratch, and progress to Python if he finds Scratch a little mundane - or vice versa, start with Python and go back to Scratch if he finds Python too advanced. However, in terms of Ruby, I can't really comment, as it's not a language I have much experience with.

Not sure that particularly helps, but good luck anyway.

Top Few

05 Jul, 2020

I was reading Tim Bray's recent blog posts (here and here) about his Topfew utility with interest, and wondered how my go-to systems programming language (Nim) stacks up compared to Go. I knocked up a quick and dirty implementation and then ran against a 900MB access_log from my own site. A minute or so later I hit CTRL+C, realising my quick and dirty implementation was (a) not quick at all, and (b) perhaps a bit too "dirty". ಠ_ಠ

Once I changed from the naive read everything into memory approach, to using Nim's streams, I ended up with something slightly more acceptable. Caveat: not really optimised (well... apart from compiling with -d:release --passC:-mcpu=native --boundChecks:off flags), lazily developed, probably still naive, but at least has border-line acceptable performance (Github).

Results on my laptop (with an approx 1.5 million line access_log):

Elapsed User System vs Go
Tim's topfew 2.68 3.86 0.41 1.0
ls/uniq/sort 9.10 1.76 0.26 3.4
Nim 3.91 3.65 0.25 1.5

1.5x isn't brilliant, but it's not bad considering the minimal amount of effort I spent on it. But that led me to wonder, what about Python performance? Another Q&D implementation later (and this time I haven't bothered to dig into the performance at all)...

Elapsed User System vs Go
Tim's topfew 2.68 3.86 0.41 1.0
ls/uniq/sort 9.10 1.76 0.26 3.4
Nim 3.91 3.65 0.25 1.5
Python 8.57 7.77 0.79 3.2

Not much better than the uniq/sort version, but the python version is arguably a little more readable than Nim. One interesting difference between Python and Nim -- the Python version does read the whole file into memory before tokenising...

with open(filename) as f:
    for line in f.readlines():

...yet the performance was significantly better than my earlier naive Nim implementation which also read the whole file. So it's not just the right tool for the job, but the right technique for the tool.

Do I feel like dusting off the rather rusty Haskell skills though...?

Two years of effort

11 Dec, 2012

Python for Kids in box My author copies arrived from No Starch today - the culmination of two years of not-an-inconsequential amount of effort.

If you happen to have ordered a copy, here's hoping it arrives in time to stuff the Christmas stocking.

New Programming Puzzle

09 Dec, 2012

puzzle imageA new programming puzzle has been added today. This one is a bit more difficult than the last - the actual solution isn't all that complicated, but it does require a bit of lateral thinking.

Engineering... or programming?

13 Nov, 2012

Are Programmers Engineers?

Rising of Coding

21 Sep, 2012

This is very clever:

Learning to code?

02 Jun, 2012

Back in 2006, author David Brin lamented the lack of a good way to get kids into programming (Brin's article was actually my impetus to start writing an e-book for teaching small humans to code): Why Johnny can't code.

Compare with the situation now...

John Naughton thinks kids should be taught to code in school. Given what is taught at the moment in UK schools for ICT, this isn't a bad idea: Why Kids Should Be Taught Code.

Dan Rowinski, of ReadWriteWeb, writes about a movement forming in the programming community around the idea of a new standard of literacy: Computer Programming for All: A New Standard of Literacy.

Matthew Murray, of ExtremeTech, has a few doubts, and thinks there needs to be more focus on the basics (imagination, logic, reasoning, and problem solving): Should Kids Learn To Code?

Jeff Atwood (also linked in the RWW article) thinks that you should learn to code for the right reasons, or else focus on more important skills: Please don't learn to code.

"But it doesn't mean anything"

08 Feb, 2014

Jeremy Paxman talking with a conservative activist on the "Year of Code" (at about 9 minutes in) announces: "But it doesn't mean anything".

By the same token you could quite comfortably argue that Hanzi, or Kanji, (or Arabic, Thai, Hindi or any of the other non-Latin derived scripts) don't mean anything. But a good percentage of the world's population seem to get by quite well using them...

(Oh yeah... and the artistic looking garbage on your big screen really doesn't mean anything ツ)