rc3.org

Strong opinions, weakly held

Month: January 2010 (page 2 of 7)

The argument against private methods

A few days ago I ran into Kent Spillern’s post, Private Methods are a Code Smell. Here’s the meat of it:

Private helper methods indicate classes are doing too many things. Moving private helper methods to different classes, including creating new classes if necessary, splits the original responsibilities across multiple classes leading to simpler, better designs.

This post hit really close to home for me because I’m a heavy user of private utility methods. Splitting code up into lots of methods is a form of self-documentation that I advocate. He talks about one misuse of private methods that I don’t indulge in:

Sometimes, private methods are created to split complex logic or processes into small, easily digested pieces. Often, such private methods have gnarly dependencies because they directly access or modify internal state.

I write private methods for the reasons described in the first sentence, but I very rarely do what’s described in the second sentence — write private methods that modify the member variables in a class. Recently, though, I’ve started moving away from private methods. I don’t mind classes with lots of methods, but when you’re writing tests, it’s easiest to deal with small bits of code with known inputs and outputs.

I’ve also gotten used to frameworks like Rails and Kohana that both support the concept of helpers, which are a sort of thowback to procedural programming. I like helpers because they’re easy to test, and because you can use them in any situation you like. The more object-oriented alternative to writing helper or “util” classes is to use superclasses. Classes that share functionality extend the same superclass that contains the methods with shared functionality. This is the approach that the Spring Framework takes.

Even though I’d thought about moving away from private and protected methods, I had never really thought of them as something to be deliberately avoided, but I’m halfway along the path to being convinced.

Google Reader now generates feeds

Google Reader will now generate feeds for Web pages that do not already have them. You can plug in a URL and it will figure out a way to track changes to the page and notify you of them. From a technology standpoint, I’m fascinated. About 10 years ago, I worked for a company called Alerts.com that tried to do this sort of change detection. This was before feeds really took off, Morbus Iff’s AmphetaDesk was probably the leading news reader at that time.

The company built custom scrapers for any Web site we monitored, and our strategy was to seek out deals with content sites to scrape their sites and generate news alerts for them. Let me be blunt: this was a stupid strategy, and I knew it. RSS was starting to take off, and any company with a real CMS can keep track of the new stuff that’s being published without any help from a third party. Even so, we had a number of large content sites as customers for these keyword-based alerts.

I was hired to work on the consumer-facing site, and my idea was to do the sort of thing Google is launching now — automatically generate feeds and news alerts for any site, not just ones that were our partners. Unfortunately we didn’t really have the resources to pursue that strategy, and after a failed acquisition by LifeMinders, things steadily went downhill until everybody got laid off.

It’s funny to see Google doing now what I thought would have been a good idea a decade ago.

How video games train football players

Chris Suellentrop has a fun article in Wired about how playing video games is creating a superior generation of football players. I think football players can learn more from simulations than most other athletes because football players have to think so much, and because they play fewer games. A lot of playing football is looking at how the other team has lined up and figuring out what they’re going to do. You can learn a lot about that by playing a realistic simulation. Sports like basketball and baseball are more about physical reactions, less about planning on the fly, so I’d expect that players of those sports benefit less.

The philosophical argument against Flash

At the core, because Flash is the only de facto web standard based on a proprietary technology. There are numerous proprietary web content plugins — including Apple’s QuickTime — but Flash is the only one that’s so ubiquitous that it’s a de facto standard. Flash is the way video is delivered over the web, and Adobe completely controls Flash. No other aspect of the web works like this. HTML, CSS, and JavaScript are all open standards, with numerous implementations, including several that are open source.

The simplest argument in favor of Flash support on the iPhone (and The Tablet, and everywhere) is that Flash is, by dint of its popularity and ubiquity, part of the web. But the best argument against Flash support is that it is harmful to the web as a whole to have something as important as video be in the hands of a single company, and the only way that’s going to change is if an open alternative becomes a compelling target for web publishers.

John Gruber on why it’s worth resisting Flash.

How the New York Times’ Netflix toy was made

So many people posted about how fascinated they were by the New York Times’ feature A Peek Into Netflix Queues that I didn’t even bother to blog about it at the time. It shows the popularity of movies on a map by zip code. It’s a great toy that will eat an hour of your time before you know it.

The Society for News Design published a piece last week explaining how the Netflix toy was built as well as a copy of the static version that was included in the paper, which I didn’t even know existed. It’s a fascinating case study, as interesting to me as the visualization itself.

Via Simon Willison.

Tim Bray on self-promotion

Tim Bray’s take on the self-promotion discussion nails it pretty well.

Chris Dixon on disrupting Wall Street

A primer on how Wall Street makes money and ways for the Internet to hurt its margins. It’s worth reading as a list of ways you can avoid financial practices that enrich Wall Street and cost you money.

Why transparency won’t save us

The response to people worried about the Supreme Court’s cataclysmic decision to lift any limits on political spending by corporations has been that we can be saved by transparency. That’s what the majority argued in their decision, and that argument has been taken up by conservatives who think that more corporate influence on the work of government is a good thing. But transparency involves only corporations documenting how much they spend, and money that goes unspent is really the crux of the matter.

Corporations have powerful levers to pull without spending a dime, given that they have the opportunity to spend as much as they like. First of all, they can threaten to withhold contributions they might otherwise make unless a legislator does their bidding. Secondly, they can threaten to spend on behalf of a politician’s opponent unless they get their way. Neither of those threats must be reported in any way. And, in many cases, the threats do not even need to be made. Politicians know what corporations want, and they now know that they can spend whatever they like to get it. Does a lobbyist for a coal company really need to call a legislator and tell them not to vote to ban mountaintop removal mining?

So we are now in a situation where the influence of corporations has been magnified to an incredible degree even before the first dollar is spent. And no amount of transparency is going to fix that.

Hillary Clinton on Internet Freedom

Because amid this unprecedented surge in connectivity, we must also recognize that these technologies are not an unmitigated blessing. These tools are also being exploited to undermine human progress and political rights. Just as steel can be used to build hospitals or machine guns, or nuclear power can either energize a city or destroy it, modern information networks and the technologies they support can be harnessed for good or for ill. The same networks that help organize movements for freedom also enable al-Qaida to spew hatred and incite violence against the innocent. And technologies with the potential to open up access to government and promote transparency can also be hijacked by governments to crush dissent and deny human rights.

Secretary of State Hillary Clinton, Remarks on Internet Freedom. This speech is worth reading in its entirety, as it’s the Obama administration laying out something approaching an Internet doctrine.

The email I sent my Congressman

Here’s the email I sent to my Congressman (a moderate Democrat) tonight:

I am a Democrat who attends precinct and county meetings, donates to the party, and went door to door during the 2008 campaign. Like many Democrats, I feel let down by what has been achieved given the large majorities we have in Congress.

I believe that passing a health care reform bill, even if it’s the unmodified Senate bill, is critically important for the future of the country. I think it is also critical for our party. Without a signature achievement to bring to voters this fall, I fear that the Democrats will suffer massive electoral defeat and 2011 will begin with our majorities substantially reduced, or worse.

Please vote for health care reform and encourage your colleagues in the House to do the same. The grass roots activists have done their part in seating a large number of Democrats in Congress, please do your part and fight hard on the issues that matter most to us. Chief among these is health care reform.

Voters and party activists are counting on you. Thank you for your time.

Older posts Newer posts

© 2024 rc3.org

Theme by Anders NorenUp ↑