PyDev of the Week: Anand Balachandran Pillai

This week we welcome Anand Balachandran Pillai as our PyDev of the Week! Anand is the author of a new book called Software Architecture with Python from Packt Publishing. He is the founder of the Bangalore Python Users Group (BangPypers) and a member of the Python Software Foundation. Let’s take a few moments to get to know Anand better!

Can you tell us a little about yourself (hobbies, education, etc):

I have done my engineering in 1998 – in Mechanical Engineering from the Indian Institute of Technology at Chennai. However I have never been a mechanical engineering even for a day in my life, as immediately after graduation I took up my first job in computer software.

Hobbies – I’ve been an avid trekker in the past, I still like to do it sometimes. Though more regular hobbies are the usual – listening to Music, Reading and going for long drives.

I’ve been an avid fan of Sherlock Holmes from younger days at school. A minor hobby is collecting Holmes stories and books in various languages. I even try his theories in real life on friends and family with variable success!

Why did you start using Python?

I first started using Python around October 2002 when I was working with a company in Bangalore as software engineer.

They were using a proprietary language – something more than C, but less than C++. I was then 5 years into my career and was getting frustrated at just knowing C and C++ and not really getting a chance to use the latter as well.

I wanted to learn something outside C/C++. I tried Perl for a while but got lost in its arcane syntax and gave up after a month. I somehow happened to come across the Python website at that time. As it says in the official tutorial (the old one – it was called “Learn Python in an afternoon” at that time!)- I literally tried it first in an afternoon – and learned it then and there.

I used nothing but the official tutorial and the official module documentation to learn Python in the initial few months.

Later on I bought a copy of “Python in a Nutshell” by Alex Martelli – and it was my Python bible for the next 2-3 years.

Note that I never used Python for any official work for another 3 more years. I mostly spent time developing hobby projects in Python – the most productive being HarvestMan – the web-crawler I wrote in Python myself.

What other programming languages do you know and which is your favorite?

I can program any day in C, having done it for more than 10 years in college and career, though my C++ is a bit rusty now.

I know Perl pretty well – I was destined to meet up with it again during my time in Yahoo! (2010 – 2012) where I wrote a lot of code in it, having lost my earlier repulsion for its syntax. I did find it a pretty productive language at that time – though once I left Yahoo!, I haven’t used it in any personal projects.

At Yahoo! I also programmed in PHP – there was no way around it – though I wouldn’t touch it with a flag-pole now if possible.

I tried to learn Ruby – but frankly I didn’t like the language as knowing Python and Perl – I guess I couldn’t find the right place for Ruby in the scheme of things in my mind – so I left any attempts to pick it up. My most recent job was in a company that used Ruby for most of its work – though I never programmed a single line in it over there. I preferred to work using Python! 😉

These days I have been spending time trying to pick up Rust and also did an online course on Erlang.

I liked the way Erlang expresses logic using patterns – it felt very symbolical and expressive when compared to anything I have learned so far. However I have never used it for any projects – yet.

What projects are you working on now?

For my current company, I am working on writing scalable crawlers – so a lot of time is spent on Scrapy and writing custom crawlers using it.

I do contribute a bit to open source projects. Recently I’ve been spending some time on Junction – the conference software that we built in the Python community in India – for powering PyCon India and similar websites – helping fix issues and mentoring some students to contribute patches.

Another goal of mine this year is to contribute more patches to CPython – I have done around 3 or 4 so far since 2008 – but I want to do more serious work there and take it up as a more or less regular activity within the next couple of years – and hopefully mentor young college graduates to contribute patches to CPython.

Which Python libraries are your favorite (core or 3rd party)?

Core – I’d say multiprocessing. This is something which I’ve been using more recently in work – to split data parallel computations across cores. I especially like the Pool object!

3rd party – Many libraries, though something I’ve been impressed with would be SQLAlchemy, considering how powerful it is and mostly been developed by just one person (Mike Bayer). I have given professional trainings on it but it never ceases to amaze me with its repertoire of tricks and recipes.

What made you decide to write a book about Python?

I’ve developed a rich and (perhaps) unique set of experiences – as an architect and as a Python programmer over the last 10-15 years of using Python.

I wanted to share my experiences in a book form – for some time. I thought of combining the way an architect approaches problems with the Python way of solving things and came up with an idea of writing a book on Software Architecture using Python.

Another aspect has been my experience with using Python for writing design patterns in a unique way.

Python can be used to write design patterns in very different ways when compared to less expressive languages like C++ or Java. One can get very creative with Python when writing patterns.

In my book I’ve tried to illustrate this in many examples on the chapters on Design and Architecture patterns – there is no need to get pedantic with Python and patterns but instead one should let his/her creativity flow!

This spirit is best illustrated by Alex Martelli’s Borg (non-pattern ?) pattern which I’ve explained in detail in the book. For examples of how to get creative one can look at the way I mix Singleton and Prototype in one pattern using Meta-classes plus my implementation of the State pattern using Python iterators – in the book.

The book URL is here: https://www.packtpub.com/application-development/software-architecture-python

Who is the target audience?

People who’ve been doing Python for more than 5 years and is getting used to its expressiveness but aren’t still sure of themselves where to go next.

People who have been exploring Python and its power – in terms of meta-classes and generators and the like – but need a guiding hand in terms of structuring their code around patterns and building the right DNA in their products towards software architectural quality attributes.

People who are in either of these categories above -aspiring to be Software Architects – and would like to express themselves – using Python in a better and more structured way.

What did you learn while writing the book?

I learned a lot about structuring my thinking right. I learned how to take feedback in the right way and incorporate into my work. I believe I have become more open minded as a result of this work – having worked with a great team of reviewers and editors.

I think the code examples I’ve given in the book – many of them came with a lot of hard work and thought about the problems and creative approaches to solving them. I myself learned a lot about concurrency and scalability when writing the book – and clarified a lot of my own misconceptions when doing research.

And thanks for reviewing my book Mike 😉

Is there anything else you’d like to say?

I encountered Python in 2002 and it’s been nearly 15 years in its company. The impact Python have had in my life is tremendous. There are lifelong friends I have made, journeys I have undertook and paths I took – because of Python.

For people who want to use and contribute to an open source language – I would say give Python a try! The community is very welcoming, the language is scaling new heights – by way of its adoption in data analytics and machine learning.

Overall for me it has been a rich and rewarding journey – and a pleasant one too.

Thanks so much for doing the interview!