Python Coding Dojo

by Kofi Sarfo 17. September 2009 22:34

We've been on a mission since last week to get exposure to the test-driven as opposed to the test-sometime so tonight we find ourselves at the offices of Fry-IT in Southwark, London watching at least two Python gurus doing Code Dojo. It's reassuring to see recognised developers halted by unfamiliar editors and settings on an operating system few here have used regularly, no matter how pretty Mac OS might be.

We witnessed a Randori Kata:

A challenge is set and solved by pair programming (driver and co-pilot). Each pair has a small amount of time to advance the solution using TDD. When the time is up the driver goes back to the audience, the co-pilot becomes driver and one of the audience step up to be co-pilot.

Folks took it in turn driving/co-politing to create a social network graph using Graphviz based on Twitter friend/follower data. For someone who'd seen maybe five lines of Python (and ignored four of them) prior to this evening, this was a nice introduction to the language as things progressed at a nice, gentle pace. Whilst getting up to speed one helpful guy pointed out his Interactive Python Tutorial written in Silverlight. Nice.

It didn't take too long to see out why the language has become so popular. Take Fibonacci:

def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b

Compared to the C# 3.0 implementation it's utterly readable

Func fib = null; fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;

The Python version fares even better than the C# 2.0 version

static int a = 0; static int b = 1; public static int DoFib(int num) { int temp_value; if (num < 2) { a = 0; b = 1; } else { DoFib(num - 1); temp_value = b; b = a + b; a = temp_value; } return a; }

Pretty good for a first code dojo; I took along a proper Python Developer to decipher some of the odd-looking, intellisense-free text appearing onto the projected screen. The next Python Coding Dojo is on in October and by then we may even have written something in Python. Baby Steps.

Tags: ,

Dojo | Talks

Comments

9/20/2009 6:00:28 AM #

Hi Guys,

I'm not sure if we got to speak together at the Dojo (I tried to get to speak to most people but failed miserably), but thanks for coming along and it'd be good to see you next time. As you probably realised, this was only a first shot at a dojo so things can only get better: fix the editor issues, start from scratch, more pizza, more beer, more screens - hell, it'll end up being better than "Strictly Come Dancing" at this rate... Wink

As someone who has 5+ years of C# / .NET experience under their belt and then found Python I can certainly sympathise with the comments you make above. But then, having said that, looking back into the .NET world from Python makes me appreciate the strengths and weaknesses of both platforms... I'd definitely recommend learning a new (preferably differently designed) language to broaden one's horizons.

Anyway, I hope you can make the next one: give me a kick and say hi... I'm the one herding the cats... Wink

Nicholas.

Nicholas Tollervey United Kingdom |

Comments are closed

Kofi Sarfo modified theme by Mads Kristensen



Content by WIMIRO Technology is licensed under a Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.

Creative Commons License

Powered by BlogEngine.NET 1.5.0.7

About Me

Director, Wimiro Technology
London, United Kingdom

Writes in third person and first person plural; currently commutes to Moorgate.

Kiva Loans

  • Norma

    Norma

    Farming

    Requested loan: $900

    Amount raised: $0

    Tarma, Peru

    Fertilizer

    Loan Now »

  • Buyanbaatar Munkhbayar

    Buyanbaatar Munkhbayar

    Taxi

    Requested loan: $2675

    Amount raised: $0

    Darkhan, Mongolia

    To build a warm garage for his car and buy wool threads for his wife's business

    Loan Now »

  • Bayarmaa Bayaraa

    Bayarmaa Bayaraa

    Retail

    Requested loan: $400

    Amount raised: $0

    Hentiy,, Mongolia

    To purchase more supplies

    Loan Now »

 To see more entrepreneurs »

Kiva Loans