Code Simplicity

Powered By WordPress
Theme Based On A Design By Jared Quinn.

Posts from November, 2011

Clues to Complexity

Posted by Max Kanat-Alexander
On November 17th, 2011 at 11:11

Permalink | Trackback | Links In

Category: Uncategorized

Here are some clues that tell you that your code may be too complex:

  • You have to add “hacks” to make things keep working.
  • Other developers keep asking you how some part of the code works.
  • Other developers keep mis-using your code, and causing bugs.
  • Reading a line of code takes longer than an instant for an experienced developer.
  • You feel scared to modify this part of the code.
  • Management seriously considers hiring more than one developer to work on a single class or file.
  • It’s hard to figure out how to add a feature.
  • Developers often argue about how things should be implemented in this part of the code.
  • People make utterly nonsensical changes to this part of the code very often, which you catch only during code review, or only after the change has been checked in.

That’s what I can come up with off the top of my head. What are some others?

-Max

Developer Hubris

Posted by Max Kanat-Alexander
On November 15th, 2011 at 11:11

Permalink | Trackback | Links In

Category: Essays

Your program is not important to me. I don’t care about its user interface. I don’t care what its name is. I don’t care that you made it, or what version it is.

The only thing I care about is that your program helps me accomplish my purpose. That’s a truly remarkable feat, and if your program does it, you should be proud. There’s no need to make your program take up more of my attention just because you think it’s important.

Now of course, your program important to you! When you work on code for a long time, it’s easy to become attached to it. It was so hard to write. Your cleverness is unbounded, shadowing lesser mortals in the mountain of your intellect. You have overcome some of the greatest mental obstacles man has ever faced. Truly, you must shout this from the tops of every tower, through the streets of every city, and even unto the caves of the Earth.

But don’t. Because your users do not care. Your fellow developers might be interested, but your users are not.

When you’re truly clever, what will show up for users is that program is awesome. It’s so awesome, the user hardly notices it’s there. That is true brilliance.

The worst offenders against this ideal are programs that pop up a window every time my computer starts. I know your software is there. I installed it. You really don’t need to remind me. If my purpose is to start up my computer so I can use it, how is your pop up window helping me accomplish that? It’s not, so get rid of it.

There are smaller ways to cause problems, too, that all revolve around asking for too much time or attention from the user:

  • “Users will definitely be okay with clicking through three screens of forms before they can use my product.”
  • “I’m sure that users will want to learn all the icons I invented for this program, so taking away the text labels for those icons is fine!”
  • “I’m sure it’s okay to stop the user from working by popping up these dialog boxes.”
  • “Users will totally want to search through this huge page for a tiny little piece of text so they can click on it.”
  • “Why should we make this simpler? That would be a lot of work, and it’s already pretty easy…for me.”

And so on.

The true humility required of a developer is the willingness to remove their identity from the user’s world. Stop telling the user the program is there. Don’t think that the user cares about your program, wants to spend time using its interface, or wants to learn about it. It’s not your program that they care about–it’s their purpose. Help them accomplish that perfectly, and you will have created the perfect program for them.

-Max