These links are for the past three days.
- fudgestudios’s bort at master – Skeleton Ruby on Rails project with a common set of plugins already baked in. I need to create a version of this for myself.
- Michael Ruhlman: Anti-Bacterial America. An inspired rant about Americans becoming germophobes and the implications of that transition.
- Aten Design Group: On Becoming a Drupal Development Shop. I’m fascinated by a company tying itself so closely to one tool.
- Jason Kottke: More on Candy Land. Pointers to an interesting discussion on the value of Candy Land as a game.
- The Guardian: Attenborough reveals creationist hate mail for not crediting God.
- rentzsch’s clicktoflash at master. New home of the Safari plugin that blocks Flash movies.
- Jack: Rack for JavaScript. Because it’s there.
- Al Arabiya: Obama tells Al Arabiya peace talks should resume. The first big interview of the Obama presidency goes to the Arab media.
- Marc Lynch: Obama to Arabs: “what you’ll see is someone who is listening”. Analysis of Obama’s interview with Al Arabiya.
- The CMS Myth.
- mezzoblue: Sprite Optimization. A very cool technique that I just learned about.
- FiveThirtyEight.com: Just Five Red States Left? This is a map we can believe in.
- Media Matters: O’Reilly don’t know much about (WWII) history. Jessica Alba knows more geography than Bill O’Reilly. Not surprising.
- Dr. Saturday: Hug your friendly neighborhood recruiting rankings. In light of the recent articles on talking about how hard it is to project the performance of professional football players based on college performance, it’s interesting that the performance of college teams can be predicted fairly accurately by the quality of their recruiting classes.
- How to Choose Chart Types. Very useful resource for determining which kind of chart to use to visualize data.
A simple rule of thumb
I was looking at some code and a simple rule just occurred to me. If you’re creating an object oriented system, any time you start writing a method that accepts an instance of a class that you created as an argument, you should ask yourself whether that method should really be a member of the object being passed in as an argument.
I’d also recommend that any time you’re asking a question about an object (in a loop condition or an
if
statement, for example), it’s worth considering whether that logic should be encapsulated as a method of the object as well.For example, you might have code like this:
It should probably be written like this:
The second example is easier to read and makes it easier to avoid keeping the voter eligibility conditions in more than one place. For example, I know that someone is going to file a bug noting that my expression doesn’t account for naturalized citizens. Keeping that logic in its own method will make it easier to fix that bug.