Overfitting code to the unit tests

Do you want to hear about that one time all the apparatus of modern software engineering - unit tests and continuous integration - actually helped the programmer to break code, rather than fix it? I was working on some code a bunch of other people wrote. It wasn't a particularly large code base, but it …

DragonBox Algebra

DragonBox algebra is a cool iPad game that teaches the mechanics of algebra in a very clever manner. The player is presented with a field divided into two halves. There is a magic box card (marked with a star) on one side (though on later levels you can suddenly see several of these boxes. These …

Walk through of a UX decision

A software developer has to make decisions all the time about how to implement something. Decisions related to the user interface (UI) of a program strongly affect the user experience (UX) which is critical to the successful adoption of the software.┬áIn this post I will talk about the design of a particular aspect of some …

Mixins or composition?

Mixins are great for "horizontal scaling" by adding functionality to a class over time. Reading mixed in code has an element of "gotcha" because the methods are scattered over multiple classes. Composition is great for handling complex functionality by insulating individual parts into their own classes and just exposing the bare interface to each other …

Another short story, where unit tests save my butt

I like to refactor. A lot. As I work on a problem I understand it better and I want to reflect this in the code. I was nearing the end of a pretty serious refactor. The tests had been failing for the last 60 commits or so. I wasn't worried, I was expecting this. But …

Embed Ace editor in a Python QT app

QT is an amazing framework, made all the more useful by having delightful Python bindings. QT supplies powerful tools to integrate host code with Javascript (web) frameworks, but they can be tricky to get started with. I wanted to integrate the Ace editor (written in Javascript) into my desktop Python program. Could I do it? …

Some macOS + Pyside2 tips

A live document, from the school of hard knocks ... Get macOS to use a fixed width font: setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) Get QTabWidget to have tabs on the left side and looking "professional" self.setDocumentMode(True) An epic can be written about the confusing behavior of menus on macOS, but the main reading material is https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar menu.setNativeMenuBar(False) # We …