rc3.org

Strong opinions, weakly held

Month: January 2009 (page 1 of 8)

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:

if (person.getAge() > 18 && person.getCountryOfBirth().equals(Country.USA)) {
    // allow person to vote
}

It should probably be written like this:

if (person.isEligibleToVote()) {
    // allow person to vote
}

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.

Links from January 29th

These links are for the past three days.

The question you wish you’d asked

How would the Romans handle the financial crisis? Tom Ricks has the answer.

Bush’s last minute tariffs

I am so glad these jerks are out of power.

Quote of the day

Matthew Yglesias’ father told him this:

To this day I remember when I was in eighth grade and my father first explained to me that there was a man named Alan Greenspan who ran a government agency that watched with an eagle eye for the day when there might be an insufficient number of unemployed people. If too many people had jobs, he was supposed to swoop in, tighten the money supply, and make sure some people lost their jobs. Otherwise, wages might get too high!

It’s important to remember this whenever people start talking about how people on welfare need to go out and find jobs, that we don’t need universal health care, and we need to get rid of “entitlements”. We have an economy managed by a central bank that tries very hard not to let unemployment get too high — or too low. Combining that with a federal government that refuses to extend aid to the people who we, as a matter of policy, keep out of work seems cruel.

Slumdog Millionaire’s child actors

slumdog_millionaire.pngTwo of the child stars of Slumdog Millionaire apparently still live in abject poverty in the slums of India. This is one of the saddest things I’ve read. It would be unjustifiable under any circumstances, but particularly in this case because the children play major parts in the movie and act incredibly well. To make a movie that in part serves to highlight the plight of children in India that at the same time exploits the children involved is not the kind of irony one can laugh about.

Here’s a snippet of the living conditions of one of the actors:

Rubina and Azharuddin live a few hundreds yards from each other in a tangle of makeshift shacks alongside Mumbai’s railway tracks at Bandra. Azharuddin is in fact worse off than he was during filming: his family’s illegal hut was demolished by the local authorities and he now sleeps under a sheet of plastic tarpaulin with his father, who suffers from tuberculosis.

For purposes of comparison, here’s a slide show of some of the gifts in the gift bag given to Academy Award presenters. Maybe they should have asked to be allowed to present at the Academy Awards in lieu of payment.

Guy Kawasaki on the original Mac team

Guy Kawasaki wraps up a set of photos of the 25th anniversary party for the members of the original Macintosh team with the following:

I hope that everyone gets at least one chance to work on such a great project with such great people as the Macintosh Division.

Unlikely. But we can dream.

Today’s post on economic stimulus, episode V

Arnold Kling deciphers two contrary outlooks on the economic stimulus package. One from Kevin Murphy and another from Brad DeLong.

It’s a great, short look at competing economic philosophies, and why there’s such difference of opinion regarding the stimulus package. I don’t agree with Kling’s conclusion, but his explanation is very much worth reading.

One of Murphy’s key criticisms of fiscal stimulus is that to some degree, it will pull private resources into the public sphere, where they will most likely be allocated less efficiently. As unemployment rises, the degree to which this will occur shrinks. Given that companies announced over 68,000 layoffs just today, these concerns would appear to be diminishing.

Links from January 26th

The limitations of blog coverage

The USS Mariner (a baseball blog) has as good a short explanation of where blogs trail newspapers and other outlets in terms of what they can provide. The topic in this case is sports, but it holds up for other topics as well:

I’m (obviously) a huge proponent of blog coverage, but there’s no way it fills the gap of a major paper. We don’t get press access. We can’t go talk to Wakamatsu or anyone on the team unless we know them personally. We don’t have the ability to spend eight hours interviewing people about a breaking issue and turning around something insightful for the next day. The research and analysis done here or on Lookout Landing or anywhere is done essentially for free (well, not Lookout Landing, obviously, as they get to bathe in a hot tub of Kos’ money every night). There’s a lot you can’t do as a writer when your budget is zero.

This disparity isn’t as large as it once was — Talking Points Memo alone has shown that “blogs” can break big news stories, but sites that do commentary are reliant on the professional, full time media to dig up the news that they comment on.

Older posts

© 2024 rc3.org

Theme by Anders NorenUp ↑