MK

Scaling a real-time pricing engine

This winter, I interned at Bloomberg in New York City. During my time there, I was on an engineering team called Foreign Exchange Idea Generation. I had the chance to work on several interesting projects, and I also learned a bit about the foreign exchange market. In this post, I’m going to discuss one particular problem I worked on: horizontally scaling a real-time pricing engine.

Building a file expiration service

This summer, I interned on the Data Warehouse Storage team at Facebook’s Seattle office. It was a great experience overall, and I’m thankful for it. In those sixteen weeks, I learned a lot about infrastructure engineering, distributed systems, and data storage technology. In this article, I’m going to focus on the main project I worked on: building a file expiration service for a distributed file system.

Semigroups and friends

What does it take for a semigroup to become a monoid? Why are all groups isomorphic to a group of permutations, and what does that even mean? When do I need to use a field rather than a plain old ring? But more importantly—what do all these questions have in common?

Fractal dimensions

Most of us are comfortable with the usual notion of dimension. We live in three-dimensional space, and we can easily picture one-dimensional lines and two-dimensional planes. Higher-dimensional spaces are much harder to visualize, but the generalization at least makes sense. Now what could it possibly mean to say that a space has 1.26186 dimensions?

This past summer, I read Crime and Punishment by Fyodor Dostoyevsky (specifically, the translation by Jessie Couson). My recommendation is hardly necessary for a classic, but I give it anyway. This “psychological account of a crime,” as Dostoyevsky once described it, is one of the most thought-provoking novels I’ve ever read. In this article, I’m going to focus on one recurring device that stood out to me: awkward silence.

Lindenmayer systems

I’ve recently become interested in a type of mathematical structure called an L-system. Invented by Aristid Lindenmayer in 1968, an L-system is a grammar that applies recursive rules to produce strings. Lindenmayer originally used them to model biological processes, such as the behaviour of plant cells. They can also be used to draw beautiful fractal curves.

Assertions and beyond

Writing code that works is hard. It doesn’t matter how many times you’ve gone over it, or how many coworkers have reviewed it. A developer with any experience never expects it to work the first time. If you’ve just written a thousand lines and they seem to work as expected, your initial reaction should be suspicion—it will lead to less embarrassment in the long run.

Chasing the infinite

What is infinity? Perhaps, like me, you were told that it’s just a concept to remind us that there is no largest number. It’s true that if you treat it like a regular number, subject to the usual rules of arithmetic, you run into all kinds of confusing nonsense. But this needn’t prevent us from studying the properties of infinity—it just means we need to be careful. The infinite is far more interesting and surprising than I could have imagined.

How to write a ray tracer

In the summer of 2012, I wrote a ray tracer called Luminosity as my first Haskell project. I’ve worked on other things since, but Luminosity remains my favourite project. If you’re itching to write some code but, after googling “coding project ideas,” digging up that Asteroids clone you never finished, combing through lists of open source projects—still find yourself in a painful discombobulation—then I suggest writing a ray tracer. The algorithm itself is surprisingly simple, but there are many other details to consider before you can start rendering images. Once those issues are tackled, though, the end results are very rewarding.

The prisoner’s dilemma

You’ve just been thrown in prison. You and another gang member were arrested, and now you are in separate cells with no way of communicating. You both deserve a three-year sentence. However, the police don’t have enough evidence to convict you on that charge, so you’ll probably end up in jail for one year on a lesser charge instead. They can’t prove it, but the police know what you really did, so they give you an option: testify against the other prisoner, and you’ll be set free while he serves three years. But at the same time, they give the option to the other prisoner. What do you do?