Friday 15 May 2015

PyCon 2015

Last month I was lucky enough to attend PyCon 2015, the largest gathering of the Python developer community, held in Montreal, Canada.  I've been wanting to write about it for a while, but sadly uni exams and project deadlines have been keeping me busy!

I was able to attend thanks to the very generous financial sponsorship offered by the conference, in particular I received a grant that covered the cost of my flight through PyLadies (who also organise a meetup I've been attending for a while, and how I discovered that this grant was available).  I think the generosity of the financial aid package shows a commitment from the Python Software Foundation (the organisers) to improving the diversity of conference attendees.  I believe this year was the first time that the female contingent of the conference reached about 1/3 in terms of conference attendees AND presenters, which is an amazing achievement.  Some fellow London PyLadies were also there and presented posters on Clojure and a Raspberry Pi game that emulates "Simon"!

It goes without saying that I met a lot of cool people and learnt tons about Python and programming in general.  I had no idea that so many companies used Python (Yelp, Eventbrite, Dropbox, LinkedIn, Survey Monkey to mention but a few "household" names....there was also a host of data science companies I had not heard of doing really exciting work), it was fascinating talking to them about how they used the language.  Montreal is also a lovely city to walk around (other parts in Quebec and Ontario were fun to visit too - check out my travel blog to see some photos).

Palais des Congres, a pretty cool conference venue!


Conference Sessions that were awesome


Keynotes

Conference attendees were treated to several inspirational keynote speeches at the start of every conference day.  Python creator, Guido Van Rossum spoke about how we wanted everyone to fully migrate to Python 3 within 5 years (a show of hands in the room suggested the majority were still using Python 2.7 exclusively) and he wanted at least 2 women on the core development team (currently there are none) by the end of the year, even if he has to train them himself!  Gabrielle Coleman gave a very interesting talk on hacker activism and the research she had done into the Anonymous group - her book, Coding Freedom on the "ethics and aesthetics" of hacking is definitely on my to-read-list.  Catherine Bracy, (director of Code for America -an organisation that hosts meetups for people to hack code that helps public sector services,  she also previously worked on Obama's re-election campaign), gave a very uplifting talk on how developers can contribute a lot to their local community, as many public sector services are still in the dark ages when it comes to their use of tech.

My favourite keynote came from Jacob Kaplan-Moss, one of the creators of Django (this is how he is often described, but he really downplays his involvement).  His talk was about how the "talent myth" drives people away from tech - the fact that you have to be a "ninja"/"rockstar" programmer to succeed (phrases that are often seen on job specs). By definition of the word, "average", the vast majority of people are average programmers, but this is something that is perfectly acceptable (he in fact said several times in his talk "I am a mediocre programmer" and he doesn't understand the hype surrounding the fact he supposedly created Django) - other careers don't expect everyone to be the best at what they do.  He believes that in tech, the expectation for everyone who works in the industry to be the next whizz kid or to do many side projects in their spare time is intimidating (although most people work on side projects because they are passionate about it, not because they are pressured to do so) and off-putting for people who are considering learning how to code.  The keynote was received with a well-deserved standing ovation, which shows that the message really resonated with the majority in the audience.



Favourite Talks:

You can click here to see just what a varied and action-packed schedule the conference had and what a difficult choice it was to go to just one talk out of the 4-5 that ran concurrently during the main conference days.  Luckily, all talks were recorded and anyone can check them out online at this link - I have a list of over 10  to catch up on that I am still working through!  I recently watched a fantastic talk from the website that I wasn't able to catch in person, called "Facts and Myths about Python Names and Values", going through what happens when you assign variables and why sometimes the behaviour you see isn't what you expect, particularly with mutable (e.g. lists) versus immutable (e.g. strings) objects.  "Usability Testing on the Cheap" was also a very interesting non-language specific talk on effective methods of collecting feedback and designing products around user experience.

From the talks I attended at the conference, I really enjoyed "Type Python, press enter. What happens?" - this was about what your computer does "under the hood" when you type python into the command line, and how the terminal deals with commands like Ctrl+C and Ctrl+D to end the program.

"Virtualenv for New Pythonistas" was also both very interesting and highly useful - it was about why it makes sense to set up a virtual environment when you are coding, not just in case you break your machine, but also if you are working on multiple projects on the same machine that use different versions of things/setups.  I had seen people use virtualenv at the code dojos and hackathons, but never fully understood why - this talk answered questions for me that I had felt too embarrassed to ask!

Another talk I really enjoyed was "Data Science in Advertising", given by a data scientist from Yelp (a website that provides reviews of local services, mainly restaurants).  This was not python-specific, but more about the challenges that Yelp faces in deciding how much to charge businesses for advertising space on their website, versus making their website helpful and non-spammy for their users - e.g. if I search for Korean restaurants near me, how should they prioritise the order in which search results are displayed?  As a user, I want to see the ones nearest to me with the best reviews, but further away/less well-reviewed restaurants may be willing to pay Yelp more to be higher up on the search results.  Yelp as a company want to maximise profits, but they also want to retain their users by providing the most useful information.  This talk gave an interesting insight into some of these issues, and also how they look at seasonal/event-based search trends to give local businesses more information (e.g. when there is a football game going on, searches for "pubs" are likely to be higher).  You can check out www.yelp.co.uk/trends to see the search trends by category and location.


Other Personal Highlights:


Coding Challenges: 

Booz Allen Hamilton (a management consultancy) ran a "capture the flag" event where there are several problem solving puzzles worth different points based on the difficulty and you are given 30minutes to score as many points as possible.  They ran a competition twice a day throughout the conference, with the highest scoring participant in each session winning a Galaxy Tablet, so I was very annoyed that I only found out about it when they were running the last session!  I managed to place a decent third though!  Thumbtack (a US consumer service company) were one of the few event sponsors that were only giving away swag upon successful completion of a mini coding challenge (see picture below) - I used the itertools library to iteratively create all the permutations and check whether they reached the solution and then proudly claimed my Thumbtack tshirt, sunglasses and beer mug.

Getting a free copy of the Python Cookbook from the O'Reilly stand

I just happened to be in the right place at the right time, and was one of the 25 lucky people to get the latest copy of the Python Cookbook, signed by the author and Python community legend David Beazley.

Meeting the BDFL

Before I attended this conference I had not even heard of this acronym - it stands for Benevolent Dictator For Life - I learnt about this acronym while at breakfast, chatting with some people I just met.  They were using it to refer to Guido Van Rossum, the creator of the Python language.  The next day, (again at breakfast), the BDFL himself happened to be hanging out at a nearby buffet station (it even says BDFL on his lanyard) so I seized my opportunity for a selfie.  He is a pretty chilled guy, and it's actually very easy to spot him during the conference, he is often milling around!

Sponsor Workshops

Free tutorials/workshops are given a day or two before the conference officially starts.  I went to Heroku 101 and Effective Code Review with Code Climate - both were very interesting and gave me a bit more insight into the processes involved with working as a professional developer.  Like many other Pythonistas I came across during the conference, the speakers were very friendly and approachable, encouraging people with any questions big or small to get in touch after the workshop.  In general, the conference gave me a lot of exposure to things/issues related with working as a developer that I don't get to see on my uni course  -I had never heard of continuous integration servers, barely understood what QA (Quality Assurance) and TDD (Test Driven Development) involved and that IDES other than IDLE was available (lol).

GPG Key Signing Party

GPG stands for Gnu Privacy Guard and is an open-source cryptographic software that is used to encrypt messages/data files.  Hopefully I will have time to cover this more in depth in a different blog post, but in short, your GPG Key is a way for people who want to send messages to you, to encrypt them for your eyes only and it is linked to your email address, and a name that you provide.  However, linking a GPG key to an email address still does not authenticate that you are who you say you are - e.g. I could make an email account called mark_zuckerberg_rocks@gmail.com (perhaps this is already taken) and link it to a GPG key, but unfortunately that doesn't mean that I am the creator of facebook.  One way to authenticate that an email address and corresponding GPG key belongs to the person's name is for others to "sign" the key, sort of like giving their stamp of approval.  One geeky way to get many people to sign your GPG key is to attend a key signing party, where other GPG afficianados turn up with their official ID documents (their actual passports/driving licences etc), show you that it matches the name that their GPG key is registered under and you use your own key to "sign" their key, which is then registered in a server.  When other people are curious about the authenticity of this person's key, they can see how many people have signed it to get an idea of how likely it is that they are who they say they are (and also how many key signing parties they have been to!).  I learnt so much about encryption and enjoyed the key signing event so much (felt like a spy!), that I might actually try to organise one myself at a meetup.  For more information about key signing, see the very helpful page written by the person who organised the key signing party at PyCon.


Conference Top Tips:


1. Pack Light:

You will be bombarded with free t-shirts, tote bags, umbrellas, books, usb extensions, stickers, rubix cubes, foam models of dragons.....there is a lot of opportunity to pick up cool swag!

2. Introduce yourself to a stranger:

The Python community is full of friendly and approachable people.  There was such a positive buzz at the conference because everyone was so excited and happy to be there (or was that just the endless supply of free coffee?).  I met so many interesting people, even if it's just striking up a short conversation in the lunch queue.

3. Apply to give a poster session/ lightning talk / a full-on talk:

It is a myth that to give a talk at a conference, you have to be the world expert on the topic.  All you need is enthusiasm for the subject and the public speaking skills to deliver the message.  Many interesting talks were given by people who thought of a topic that they themselves wanted to find out more about,  and researched more thoroughly after finding out that their proposed topic had been selected as a talk!  Neither does the talk have to delve into the intricate technicalities of coding - talks are tagged with Novice/Intermediate/Expert background knowledge assumed.  By presenting a poster or a talk, I think you are giving something back to the community and it's a great way to put yourself out there!

4. If you can't afford to go, apply for a grant:

There's no harm in taking a few minutes to fill in a form, write about how much you would love to attend, what you hope to learn.  I did it for PyCon back in late 2014, without any expectation of receiving a grant, so it was a pleasant surprise when in January I received an email telling me I'd gotten it!  I believe EuroPython 2015 (INSERT LINK) also have a financial aid scheme, and I've heard that generally other conferences do sometimes have the ability to award travel grants, especially for students or those who are doing a poster session or presenting a talk.

Sunday 15 February 2015

Programming and Pizza Perks

Java is one of the most commonly used programming languages in the world and derives its name from the fact that programmers are apparently addicted to coffee.  While I have not seen much evidence of this (maybe because the labs at Imperial forbid you to bring in hot drinks), I can say that ever since I started programming, my consumption of pizza has gone up exponentially.  In fact, I'm sure I can produce a graph that charts the progression in my programming skills with weekly pizza consumption that would indicate a significant level of correlation - surely there must be causation in there somewhere!

Almost every tech related meetup or event I have attended is catered with pizza.  It is convenient and easy to eat, the vast majority of people like it, you can have great vegetarian choices and toppings to satisfy meatlovers alike, it is probably quite cheap and doesn’t taste too bad when slightly lukewarm either.  There is already a programming language called Pizza but it definitely ought to be more mainstream!

In an alternative post to one about programming, I thought I would write a review of the best takeaway pizza that I’ve had at programming meetups! I would also like to give a shout out to Women Who Code and PyLadies for bucking the trend and providing delicious non-pizza catering (as well as desserts!) at their most recent meetup!

Basilico 


The codebar meetup is particularly fond of ordering from Basilico, partly because they are careful to cater to gluten-free and vegan diets.  This is how I got to try vegan cheese for the first (and last) time (I promise I was not stealing food from vegans - the vegan Margherita pizza slices I snaffled were unloved and would have otherwise been destined for the bin). For anyone who has not yet had the pleasure, it is an interesting shade of highlighter yellow, has the same consistency as very cheap cheddar and the only similar taste to real cheese is general savouriness.  Luckily, Basilico’s normal pizzas are otherwise delicious - their sundries tomatoes can be slightly acidic and too tangy, but their white pizzas  are delicious, the slice sizes and topping distribution are just right.  They also do delicious and very healthy juices and salads (again, kudos to codebar for ordering these extras!).

Dominos


The classic pizza delivery chain has improved a lot in recent years - they have great variety in both their meat and veg toppings.  I especially like their Vegi Supreme and Vegi Volcano pizzas - they have the right idea with their meat pizza topping combinations, but the quality of the meat can't really compete with the more gourmet meat options offered by Basilico, Lupa and Franco Manca.  Although the base is not too sophisticated, and the cheese is just a tad on the rubbery and greasy side, you know that you are going to get a satisfying meal.  Dominos also do something unique with their pizzas by supplying a dip  - die hard pizza afficianados may argue that a good crust and high quality toppings need no extra dressing, but I say having a garlic or barbecue dip can only be a good thing!

Franco Manca - BEST BASE AND BEST MEAT


It is almost worth ordering their pizza just for the delicious sourdough base, which apparently takes 20 hours to rise and has its roots in a sourdough starter that is 500 years old?!.  The quality of ingredients used for the toppings (especially the sausage and cheese) is amazing, although a few more vegetables would be nice.  The reason why Franco Manca is not my top choice is because of the topping distribution - the coverage is far too sparse and they cut their slices very unevenly so some slices are basically margheritas.  Quite often the toppings are not firmly attached and roll off easily when you are trying to eat and mingle at the same time!

Lupa - BEST ALL ROUNDER


In terms of taste, Pizza Lupa is my favourite and I have thoroughly enjoyed all of the toppings I have tried.  I especially like their goat's cheese, sausage and roast vegetable toppings (not all on one pizza!), but to be honest their wide range of pizzas are all top notch. The base is inconveniently floppy but the taste more than makes up for this, and I find their pizzas are especially resilient to falls in temperature - the cheese doesn't go rubbery when cold!  One thing I would say is that they need to cut their slices A LOT more - they are absolutely huge!!!  I'm one of those people who loves trying a little slice of lots of pizzas, but one slice of their large pizzas (circa 17 inch) is not too far off half of a 12 inch pizza!  Also, Pizza Lupa if you are reading this - although it doesn't affect the quality of your produce, I would suggest you hire a better web developer/designer!

Pizza Hut


There’s not much to say really -  their pizzas are solid but unspectacular, heir range of toppings satisfy most palates, but are not particularly imaginative and in the absence of special offers, they are not great value for money.  I get the impression that the company is more focused on their restaurants, where they emphasise that they are also great at doing salads and pastas (remember when they changed their name to Pasta Hut for a while?).    One especially noticeable difference with other takeaway pizzas is that the base is relatively more rigid, which improves ease/tidiness while eating!

Voodoo Ray’s - BEST WEBSITE


I have only had Voodoo Ray's once at a tech meetup and they are a solid contender, with interesting and slightly unusual topping combinations.  They are better known for their Dalston branch and van which pops up at various food markets, where they specialise in selling pizza by the slice rather than in whole units - a concept that I'm very supportive of.  Some online reviews do suggest they are on the pricey side though, so perhaps that's why not many meetups order from them. However, their very colourful and eye-catching website (I guess they are based in Dalston after all!) is well worth a visit (and bookmarking for future web design ideas!)

Other Pizza that I paid for myself and have thoroughly enjoyed:


Monday 19 January 2015

Seven Deadly Programming Sins

Now that mid-January has passed, is it too late in the year to greet people with "Happy New Year" or think about New Year's resolutions?  On the latter, I like to think that it is never too late to turn over a new leaf (or at least have intentions of doing so).  Given that this time of year is often associated with detoxing our minds and bodies, I thought I would do a blog post about programming sins (very loosely related to the original Catholic sins!) that we might like to cast aside in 2015.

Pride

Disclaimer: Despite being a proud geek, I'm not actually a trekkie - Star Wars all the way!

Often considered to be the most serious of the sins and the source of all other sins, this is no less true in the world of programming.  Overconfidence or underestimating the needs of the problem at hand can have disastrous consequences later on, as you realise you have not taken into account all of the potential special cases/situations possible!  It can be all too tempting to get stuck in straight away without reading all of the specification in detail and drawing out a plan of action.  Taking a humble step back and a few minutes to model a problem with pen and paper, can save hours of potential refactoring further down the line (see a previous blog post on how to problem solve).

Checking your code before hitting the Enter key is also vital - a commonly given example is when using the command line to delete files on Unix terminals:  "rm *.doc -f " means remove (rm) all files that end with the .doc file extension and don't bother asking if I'm sure I want to do this (-f).  However "rm * .doc -f" (note the space between * and .doc) means remove ALL FILES, then remove any files that are called .doc, and oh yeah, don't bother checking whether this is what I really want to do!!

Overconfidence can also lead to forgetting to save your code (or commit changes) frequently!  Computers don't crash these days, so this is never a problem, right?!

Sloth


A lack of attention to detail or leaving it up to the compiler or your code editor to detect errors can be the root of many debugging frustrations! Whether or not you include that one little character can make all the difference and could come back and torture you for the next hour as you attempt to figure out why your code isn't working (a particularly bad state to be in when under exam conditions, as I recently discovered!!!).  From time to time, I'm sure all C programmers have been caught out at one time or other by one of these bugs...

  • while(x=y) This statement will always evaluate to true, as the variable x is being assigned a value y.  If you want to compare whether the value of x equals y, you need that all-important second equality sign!
  • for(x=0; x<100; x++);  That extra semi-colon tells the compiler that this command ends here, so it means that the for loop just increments x 100 times without actually stepping into the code that you have written in the body of the loop!
  • Passing input parameters by value rather than by reference: If you want the function to make alterations to your input parameters, rather than just making a copy of it, you need to remember to add an '&' before the parameter in the function definition!

Vanity

Ok, it's really hard to find a funny picture on vanity!

A friend once told me that they have heard it being said that "premature optimisation is the root of all evil".  Related to pride, a desire to make your code look elegant or "clever" combined with failing to understand the requirements of the specification can lead to misery, frustration and obfuscation.

I was also once the victim of vanity in a different way - after finishing writing a simple Python program, I thought I would try to tidy up the code a bit to make it look prettier - spacing out functions and comments a bit more...all the while forgetting that whitespace actually matters in Python!!! Needless to say, it took me quite a long time to work out why my program was no longer working, but it was a tough lesson learnt in how spacing affects code in Python!

Gluttony (for memory!)


Getting the hang of memory management is an integral part of C++ programming.  Computer Science students dread the "Segmentation Fault" error when doing their coursework on manipulating pointers, caused by their program trying to access areas of memory outside of the allowed bounds of their program, or an infinitely recursing program that uses up all the available memory space while running.  Using uninitialised variables can also lead to confusion - consider this code:
int x; x++; cout<<x;  No value for x is declared when the variable is created, but x is likely to hold some value - whatever previously happened to be at the memory location the computer has assigned x to, so printing/accessing/using the value of x will not fail - instead it will just be gibberish.

None of these issues are caught at compile time, but become apparent at run time.  Of course, failing to free up dynamically allocated memory is also a cardinal sin, although many modern computers "forgive" this by automatically freeing up any memory allocated on the heap when the program exits.  This issue can be avoided all together if you program in a language like Java, where unlike C++, memory management is taken care of for the programmer....this has always made me slightly suspicious of the language, as if it were leading the coder into temptation...

Repetition 


If you have lots of repeated sections in your code, there is almost certainly a way to redesign it more efficiently.  Let the computer do the repetitive work - that's what it's there for!

Obfuscation

Perhaps nobody deliberately goes out of their way to make their code difficult to understand (unless of course you are entering into a Code Obfuscation Competition), but it is worth taking the time to either comment your code or dedicate that time to making your code clearer for the sake of the sanity of your fellow programmers.  Sometimes when we have been given coursework, I often think there is clearly one obvious and mainstream way to solve the problem - this is simply not true.  The variety of ways in which people tackle problems is vast (and in itself very interesting, as well as something that is great to learn from).  At the same time, it is difficult for someone else to put themselves in your shoes, see the world from your perspective and adopt your way of thinking.

Interdependency 

I think this is the least serious of the sins I have discussed here, mostly because sometimes it is unavoidable.  Ideally, there should be as little dependency between functions or between classes as possible, with each section of code being allocated a certain task that it can carry out on its own.  Not only is this more efficient, but it should also enable speedy refactoring of your program if the need ever arises. However, sometimes you just can't avoid needing to have two classes that simultaneously rely on each other - in that scenario, all you can do is make sure you have your class declarations the right way round - I have found myself referring to this Stack Overflow link more than a few times!


This is by no means a comprehensive list of programming sins, and some may have noticed that of the seven original deadly sins , I did not incorporate Wrath, Lust and Envy, although these are emotions that I have often experienced while doing coursework (i.e. "WHY DOESN'T THIS CODE COMPILE?! GRRR, sometimes followed by asking a fellow student "How did you get it work on your machine?!").