Five years later, the Ariane 5 story is still my favorite software bug

I first learned about the Ariane 5 explosion, partly caused by reusing Ariane 4 code, around five years ago at a one day taste of YoW! 2012 in Sydney, where I was also introduced to Don Reinertsen’s Keynote on the Practical Science of Batch Size (unfortunately it looks like the Melbourne copy of that video is not currently available, hopefully it comes back sometime).

In any case, still my favorite bug:

https://around.com/ariane.html

 

Follow up 16 Nov 2017 – It’s come to my attention that Bugsnag agrees too. Good on them!

As a customer, why I’m quitting Uber

I used to use Uber about twice a year, at other times I’m a huge public transportation fan. The change to require tipping to get a 5 star rating (because people respond to incentives) is a complete surprise to me.

In essence, Uber didn’t learn anything about setting (and appropriately notifying the public about changing) their tipping expectations. As the most likely source of my surprising and only less than 5 star rating several months ago (the driver never told me either), I now don’t see any value in Uber over the tried and true taxi system, where it is well known tipping is expected, and even very clearly visible on both the airport receipts and cab windows that tips are not included (and thus expected in the US, unless say the cab is really dirty or smelly). Further it’s far less likely to be able to come back and haunt you Black Mirror style. It doesn’t look like the average person gets to have a say in that either.

The sad part is eBay has known this forever, as a seller it’s not even possible to leave a negative or neutral feedback rating for a buyer. Uber’s sneaky change and failure to learn the lessons of history has cost it a customer permanently.

What’s particularly sad to me is that it could be a simple monetisation route to keep everyone explicitly happy – as a customer, pay us 20% more on the fare for each star rating bump, at least half goes to the driver. Because reputation can matter, and people (including cab drivers) do matter.

More context: https://www.thezebra.com/insurance-news/1074/should-you-tip-your-uber-driver/

P.S. That says nothing about allegations of sexual harassment leading to mass firings, it sounds like they have a lot of work to do.

Helping start something – Australian Affordable Housing Party

Disclaimer: These views are my own, and do not necessarily represent the views of the Australian Affordable Housing Party, Dick Smith’s Fair Go, the Australian Labour Party, the Liberal Party (of the Menzies era), or any other individual or organisation.

 

For years I’ve been concerned about rising housing unaffordability in Australia. Rational Radical’s graph here covering the period from 1880 to 2014 describes it better than I can.

Australian governments, such as the Menzies government in the post-WWII period knew owning your own home (at a reasonable price and thoughconnected to appropriate infrastructure) was first and foremost for shelter and security, basic human needs not currently provided in the rental market. Owning a home is a critical core piece of the presently smashed Australian Dream that laid the groundwork for the 1970s multicultural pact and is a huge driver of intergenerational wealth inequality within Australia.

Our investment-property laden politicians deserve to be reminded of that reality, or they too can continue to ignore the lessons of history (and perhaps be doomed to repeat it).

So that’s why when Andrew Potts decided to start something called the Australian Affordable Housing Party, I was ready to jump up and say “me too” and pitch in with support when I can between my other responsiblities – to serve God as best as I am able to, to keep myself in good health, to put food on the table via the good job (thanks Joe) I currently have, and my hobby of teaching robots to play soccer.

Most likely I’ll continue watching this from the sidelines, perhaps even from the US (presently the land of Trump, for better or worse, whether or not “The American dream has failed”), if I can engineer an opportunity to build some perspective, while Australia wonders collectively about the underlying drivers of its lost decade when for instance real incomes grew just $3 per year.

That’s the balanced me that would accept a slow melt. A part of me would actually welcome a recession and a >50% fall in prices – because “Price is what you pay, value is what you get”, and I suspect most people know a family home isn’t really worth $1.3 million, it’s still just 3 bedrooms, a bathroom, kitchen/dining and car space. As a thought experiment, it could be government-mandated that housing is priced exclusively in housing stamps (a play on food stamps) and you can only get them by working for the government.

The current system is a trade that I believe happens to be a very poor one resulting in a massive transfer of wealth from the younger millennial generation who are often still laden with tens of thousands of dollars of student loans, to a select few investment property owners and developers, such as Harry Triguboff. And to be honest, I actually voted for developers in the recent local council elections, developers have a responsibility to maximise their shareholders (which could be just themselves) return on investment so they can stay in business; it is governments which have a responsibility to ensure there are enough developers in the marketplace that there is reasonable competition between them, and most importantly that there is enough housing supply available to meet the demands of the expected future population.

Thus the fixes to this engineer’s mind are potentially very simple – reduce demand by reducing immigration to the long-run average of 70,000 per year, such as Dick Smith’s Fair Go campaign has proposed, reduce demand by reducing tax incentives encouraging speculative “pina colada” investment in property such as halving the very generous 50% capital gains tax discount and allowing negative gearing for new builds only; or increasing supply through releasing more land and enabling developers to build on it, and building the infrastructure to service that land.

It doesn’t really matter whether new infrastructure comes through governments or developers – last I checked I’d rather pay a new infrastructure levy to finance some kind of municipal bond (or equivalent) than actually dig up a front yard to build a sewerage pipe, lay fibre optic cable or electrical cables, and I certainly wouldn’t be wanting to build a school or hospital myself. Well-connected high-speed rail or better yet a hyperloop could also be wonderful alternatives.

A bit more about me – I have participated in the rental market for the past 3 years after living with parents for 8 years (so after 5 years of university, I’m currently at 6 years saving for a house dwelling deposit), and as I have a good job, don’t own a car or have addictions like smoking or drinking and paid off my HECS-HELP debt early, this is telling me the system is currently broken.

That doesn’t make it my responsibility to fix this broken system, but I’m happy to contribute towards anything that I believe might fix it, like being a founding member of and donor towards the Australian Affordable Housing Party.

Final post?

So after several days of back and forth, and thanks to my parents neglecting to tell me pjschmidt@bigpond.com would lapse, it’s come to my attention that I’ll need a Notary Public to prove I’m me and thus that I once owned / but a NP is something like $250 + GST (404, archive) for something I use about twice a year.

By and large no one will probably read this at https://pzrq.squarespace.com/ but it’s there if anyone really wanted to track it down. Might let Squarespace lapse too, it was good while it lasted but didn’t get me HTTPS soon enough when I was looking at it, and especially with this new straw I think it just isn’t something I derive sufficient value from relative to the cost, especially compared to hosting something on AWS/GCP/Azure which I’d actually find a fun challenge if I had the time.

Yep, learning the hard way

Woohoo! Lesson: 
Hi <name>, 
How’s your day been?

25 odd characters of awesomeness, thanks <name>.

Got to tone down these intricate 30-second thoughts, TMI, and come back to Earth.

Fascinating how the academic world of course tends to push so hard in the other direction towards theses of hundreds of pages, but that doesn’t excuse me for being an $%^hole.

I suppose I’m just happy I at least got to learn something, thanks <name>.

Can you upgrade to Python 3?

Basically it comes down to whether your dependencies are up to date and if they aren’t, if you want to help and contribute back to the community to move them along. The easiest is to drop your requirements.txt file into:

https://caniusepython3.com/

 

Both of the following are also excellent tools to get an overview of how well the community is progressing:

https://python3wos.appspot.com/

http://py3readiness.org/

Python 3 in Production at Mathspace

And Python 3 only in development.

A huge thank you to everyone on the Mathspace Team who supported, reviewed and helped out with this endeavour.

One day the Mathspace Team will put up a dedicated engineering blog, but until then this can live here.

For those who haven’t heard me talk about bringing step-by-step working out, handwriting recognition, teachers never needing to mark homework again, adaptive mastery-based learning, geometry, interactive graphing, calculus, The Martian content (currently under development) and so on to High School and College education:

https://mathspace.co

Love it? Want to help make it happen faster for parents, students and teachers? We’re hiring.

 

Mathspace Overview

8 or so developers, similar number of content team members, lots of sales and support staff, moving to a bigger office soon.

 

86 Python Dependencies 

pip freeze | wc -l

 

147 Django models across two databases

len(get_concrete_models(models.Model))

 

~160k Python LOC

find . -name “*.py” | xargs wc -l

 

Driving change

Above all do it incrementally, following lean startup ideas such as reduce batch size, thanks Don Reinertsen, and thanks for coming to YOW! Sydney.

Based on:

for i in $(git log --grep="py3k" --format=format:"%H" --all); 
do git diff $i $i~1 --stat | grep "changed"; 
done;

Some quick git stats:

  • 42+ specific merges to master between 30 August 2014 and 11 January 2016. It just wasn’t quite ready for Christmas/New Year 2014 so as things go we built out more math features.
  • 1629 files changed
  • 18027 insertions(+)
  • 16885 deletions(-)
  • So around 11% of our code base changed, including the final 2to3 conversion, but excluding final few bug fixes for legacy code without unit tests.

Most of the development battle felt like it was dependencies because frankly GitHub is awesome but there’s always higher latency than tapping a colleague on the shoulder or @colleague in Slack or Trello.

Upgraded dependencies

Switched out dependencies

  • Fabric => Fabric3 (at least until @bitprophet decides to give us Fabric2’s alpha)
  • python-cloudfiles => apache-libcloud
  • suds (SOAP/WSDL) => Stripe billing gateway (might also use PySimpleSoap which claims Python 3 support, but it failed our unit tests before the Stripe switch and its master was broken with a print statement for months which is unfortunately not very confidence inspiring)

Removed dependencies

One pleasant point was upgrading Django because we have pretty good unit test coverage:

# -Wonce works too, just
# -Wall is funner to read out loud
python -Wall manage.py test

Tells you what’s RemovedInDjango18, RemovedInDjango19, RemovedInDjango110, which you’ll need to fix sooner or later.

 

Making the switch

Basically the things that broke were things with no unit tests. We fixed all of them over a weekend with a few quick deploys, thanks to David Cramer and the Sentry team.

How did we build the final branch?

0. Move anything that works under Python 2+3 off into a separate branch, reviewed and merged regularly.

1. pyenv (or homebrew) to install Python 3

brew update
# Mavericks and El Capitan come with versions of SQLite3 that
# segfault when running "./manage.py test", so update it
brew install sqlite3
brew link --force sqlite3
brew install pyenv
# Tell pyenv to use updated SQLite3
# https://github.com/yyuu/pyenv/issues/333
# Takes around 2 minutes
time PYTHON_CONFIGURE_OPTS="LD_RUN_PATH=/usr/local/opt/sqlite/lib LDFLAGS=-L/usr/local/opt/sqlite/lib CPPFLAGS=-I/usr/local/include" pyenv install 3.4.4
# Test it
$ python
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.10.1'
# Remember to use it when making virtualenvs:
mkvirtualenv mathspace_py3 --python=$HOME/.pyenv/versions/3.4.4/bin/python

2. Look for outdated dependencies, update them, split off upgrades of dependencies with 2+3 versions when possible.

3. Update / migrate our code base internally. As an end project, 2to3 was a better choice than six.

  1. 2to3 . --output-dir=. -n -w
  2. Fix imports 2to3 did not get right so unit tests run. DiscoverRoadRunner was invaluable saving me 4 minutes per test-driven-development cycle, I know I should spend more time on it though Django 1.9’s builtin test runner does “–parallel” 🍻
  3. Fix other things 2to3 tool did not get right, e.g. Django’s smart_unicode => smart_text
  4. Update or fix unit tests under Python 3 accordingly, things like tests that failed with different PYTHONHASHSEED values that were bugs under Python 2 but only detected under Python 3.
  5. Check things like the following don’t throw errors, add unit tests if they did:
    ./manage.py runserver
    ./manage.py celery worker

4. Add new Python 3 servers – thanks Rackspace devops for getting poise-python working so supervisor can stay under Python 2.

5. Test on staging environments for any issues.

6. Deploy to production.

7. Fixed a few things fast. Thanks to Sentry we could pounce quickly. Maybe 20-30 users affected by Sentry events total, so 99.94% or more of our >50k users in that particular low-traffic week would never have noticed, anecdotally better than our last Django upgrade.

Was it overengineered? Perhaps, but to channel Django, Mathspacers can be perfectionists with deadlines, and we do think it is very important to provide the best experience we possibly can for parents, students and teachers.

 

Profit

  • Better unit testing
    with self.subTest()
  • Cleaner superclass calls:
    super()
    
    # Instead of monstrosities like
    super(MyClassName, self)
    super(MyClassName, cls)
    
  • Cleaner types and unicode support:
    long->int, str => bytes, unicode => str
  • Can’t easily go the wrong way when using:
    .decode() or .encode()
  • No re.UNICODE flag required in regular expressions.
  • Don’t need to remember
    # -*- coding: utf-8 -*-
    from __future__ import unicode_literals
  • No cryptic backtick syntax:
    repr(a) == `a`
  • Don’t lose original error if another error triggered in an except block
  • Hundreds of other bugs fixes and feature improvements: https://docs.python.org/3/whatsnew/changelog.html

Nick Coghlan can tell the full story far better than I:

http://python-notes.curiousefficiency.org/en/latest/python3/