The Life of a Programmer

Archives

All of the things labelled as Posts, so that crawlers have a place to find them.

What is an idempotent function?

Idempotence is an essential tool in programming. It has many uses, from improving fault tolerance, clarifying code, to writing declarative deployment scripts. It’s important to

What is amortized time?

Amortized time is often used when stating algorithm complexity. Instead of giving values for worst-case performance it provides an average performance. This is appropriate in

The false abstraction antipattern

Useless interfaces, factories, and other abstractions are everywhere. They are the result of trying to prematurely generalize code. In a recent article I wrote about

Why social media needs to manipulate you

Has Facebook really done something deviant with their emotional feed experiment? Sure, it is despicable and unethical, but it wasn’t truly different from what is

Removing code by adding features

The pinnacle of refactoring is the removing of code by introducing a new feature. It may seem like a ridiculous notion, but I’m often surprised

Allowing unlimited access with CORS

Opening a REST service for browser use requires CORS. Browsers have a very strict cross-domain policy that will either block the request, or just block

Stop signing crappy contracts

Just because you’re given a bad contract doesn’t mean you have to sign it. I was recently offered a programming position that came with a

The Infernal Loop Iterator

Collection iteration is perhaps the most insidious language construct. Simple to create and easy to understand. Yet lurking within lies the ability to create random

Strings and Text are not the same

Thinking of text and strings as the same type is wrong. It leads to all kinds of errors and results in confusing or incomplete APIs.