The tweet rule

Reading time ~1 minute

I ran across this lovely little interface method today:

public interface IOrderProcessor
{
  TransactionResponse CreateOrder(
      Cart cart,
      string email,
      Payment payment,
      Address billingAddress,
      Address shippingAddress,
      string notes,
      int orderId);
}

Aside from the glaring SRP violations, the main thing about this method is it’s length. Holy god is it long. I immediately wondered if I could tweet it. Just as I thought: no dice.

It struck me that maybe that was a pretty good guideline. Twitter’s made a massive (and I mean ungodly huge) business off of 140 characters. That seems to be a good indication of the attention span of the human race, so it seems that it’s a good indication of whether your method signature is too long.

So as of now I’m going to adopt the Tweet Rule™:

If your method signature is too long to fit in a tweet, then it’s too long.

I’m going to strive to keep all my methods obeying this rule, as well as under 10 statements in length (roughly). It will be interesting to see how these limitations affect the way I solve problems in code.

ReactJS, or 'Why Client Side Is Fun Again'

A (hopefully) comprehensive walkthrough into ReactJS Continue reading

Programming the Infinity Keyboard

Published on February 25, 2015

Embedded Razor that doesn't suck

Published on November 25, 2014