Tuesday, August 20, 2013

Minimalism, KISS, elegance

This essay is just some exploratory thought sparked by http://www.zedshaw.com/essays/master_and_expert.html. It's worthwhile reading for anyone. You should read it.

I'm guessing you probably didn't read it anyway, so here's the summary: Masters of any subject know how to use the minimum amount of resources to accomplish goals. Experts like to build complexity where it doesn't exist to show off their prowess at handling their created complexity. For every time someone makes some computer function ridiculously simple, there are 10 companies putting buttons and knobs and whistles and levers onto something as basic as email.

What do I have to add? Well, the first things that come to mind are how this idea can be used in practice: When looking for places of employment, do the coworkers add complexity or remove it in their day-to-day activities? Do you find people engaged in discussions about arcane lingo that was internally invented to discuss invented complexity or are the discussing the underlying problems?

People who are good examples of this that spring to mind are John Maeda and Donald Knuth.

One of the reasons I love squash is that it is such a ridiculously demanding physical sport that to play at an advanced level you must remove any wasted movement; Ceteris Paribus, anything but the minimal path around the court means you lose.

In short, I'll end this rambling with a simple reminder: For those of us in technology, always ask yourself: "Am I making my users' life easier by removing complexity or more difficult by adding complexity?"

Friday, August 16, 2013

Rails Callbacks: Being a Good Neighbor

Using callbacks like before_save, after_destroy, etc. in your rails models is a very important way to ensure that the things you assume about your data are actually enforced.

If you return false, and halt the callback chain, be sure to include error messages via errors.add("..."), so the caller knows why it failed.


Class User < ActiveRecord::Base

  before_save :update_other_subsystem

  def update_other_subsystem
    success = some_other_subsystem.send("new user!")
    unless success
     errors.add("couldn't update the subsystem")
     return false
    end
  end
end



This is a pretty contrived example, but you get the idea.