rc3.org

Strong opinions, weakly held

Month: July 2007 (page 1 of 4)

Web 2.0 vs Open Source?

Are Web 2.0 and Open Source headed for a collision? Here’s Stephen O’Grady:

While these two dominant technical trends or directions have much to learn from each other, the convergence is likely to have its painful moments if OSCON is any indication. Indeed the talk of the conference was the somewhat shocking public swipe at Tim O’Reilly by one of the GPLv3’s chief architects, Eben Moglen. As documented elsewhere, Moglen absolutely dropped the hammer on Mr. Web 2.0, arguing that “that the FSF has ‘done the heavy lifting’ and ‘carried your water’ for the last decade, and that the era of Web 2.0 distraction (buzz about who is making money, who will get acquired, etc) will need to be replaced by a serious conversation about freedom.”

It’s a very interesting discussion, and not least of which for the reason that Web 2.0 is built on Open Source. That’s a bug in the system. The GPL and other licenses were built for an age when you distributed software, and work because they require you to distribute the source code for your software along with the binaries. These days, most new applications are not distributed. You just provide access to them on your own server, and you’re not obliged to distribute any code.

So everybody these days is building Web applications using Open Source, but they’re keeping the code to themselves. When the innovation is returned to the Open Source community it’s out of charity rather than obligation.

That said, I don’t see the pace of innovation slowing at all. Leave out JavaScript, where the pace of change is incredible but everything is “open source” even if it’s not Open Source. We’re seeing huge progress in all areas of server side development. There are more and more Open Source applications, frameworks, and libraries every day, and the ones most people rely on keep improving. Just in the past couple of years, we’ve seen the rise of innovative platforms like Ruby on Rails and Django, and now we’re seeing their innovations rolled back into the platforms that preceded them like Java/J2EE and PHP.

It seems to me that even if Open Source licenses are, to some degree, obsolete, the Open Source culture has deeply and permanently taken hold in the Web development community. Developers are sharing code and knowledge, and Web applications keep getting more powerful and easier to write.

Links for July 31

I’m running a few days behind on these, but I’m not going to let that stop me.

The Los Angeles Times spiked a column because it frankly took on the newspaper’s money issues and suggested ways to fix them. Unsurprisingly, it turned up online. When are they ever going to learn?

Nelson Minar explains how Microsoft is inflating its search rankings by integrating hidden searches into its online games.

Jim Henley posted a novel theory on how the current Iraqi government sees Iraq as a “bust out.” Sadly I think he’s right on the money. Yesterday NBC reported that corruption in Iraq is untouchable. Peter W Galbraith has proffered yet another exit strategy for the US in Iraq in the New York Review of Books.

On a lighter note, here’s Pudge singing Perl in a Nutshell.

Here are a couple of links I found useful in a discussion of media bias. The CBC describes its policy on the use of “terrorist,” and here’s Reuters explaining its policy.

The Texas State Board of Education is now headed by an evolution denier.

Here are a bunch of Ruby on Rails links I ran across catching up on my feeds:

  • The Hobo Migration Generator enables you to shrink your migrations.
  • Here’s a tip on using blocks with helpers to enable you to remove more code from your views.
  • PeepCode offers an Rspec screen cast that I’ll probably take a look at before I start my next Rails project.
  • Sphinx is a full text search library for Ruby that can be used in lieu of Ferret.
  • Dave Thomas on Symbol#to_proc.
  • rails_creator is a script that generates a new Rails application more robustly than the built-in Rails generator.
  • Here’s an explanation of how to hook up your Rails automated tests to Growl. (If you don’t know Growl, you’re probably not a Mac user.)
  • Charlie Savage on profiling Rails applications (more here).

Bruce Schneier interviews TSA administrator

Bruce Schneier was invited by the TSA to visit them in Washington and talk security. One of the outcomes was Schneier getting to interview TSA administrator Kip Hawley on the record about security procedures. Schneier’s questions are great, and Hawley’s answers are definitely fodder for discussion. Don’t miss it.

Avoiding Harry Potter spoilers

I have my copy of the final Harry Potter book sitting on my night stand, just waiting to be read, but I haven’t started reading it. It seems like people are still being very careful with the spoilers, but I know that at some point, that will pass. I’m a little bit anxious about finishing it before that date arrives. How concerned am I? I was at a restaurant the other night and a teenager sitting a table or two over began to discuss the book rather loudly, and I was almost moved to violence. Fortunately someone at his table who hasn’t read the book yet cut him off.

Obvious programming tip for the day

Any time you have an expression in your code, it answers a question. For example, you might have an expression like this one:

if (cart.getItems().size() >= 5) { cart.setShipping(0); }

A lot of times you’ll see code like that in a servlet, or in a controller if you’re using an MVC framework. What I’ve realized is that such code should always live in whatever class “cart” is, and the number 5 should be stored in a constant somewhere.

So in Cart.java you might have:

public static final int CART_SIZE_FOR_FREE_SHIPPING = 5;

and a method like this:

public boolean isEligibleForFreeShipping() { if (cart.getItems().size() >= CART_SIZE_FOR_FREE_SHIPPING) { return true; } else { return false; } }

Then back in your controller, you’d have a snippet of code like this:

if (cart.isEligibleForFreeShipping()) { cart.setShipping(0); }

Why go to so much work for one tiny little expression? There are two reasons, both associated with DRY. First of all, that 5 is an important piece of information. You may have expressions containing the number 5 throughout your code, with various meanings. If you want to lower that to 3, or raise it to 7, doing a search and replace on your code isn’t going to work. That value needs to live in one place, and a constant is as good a place as any. (If you want to change it on the fly you’ll need to extract it from your code and store it in a database, of course.)

Moving up a level, you only want the business logic that determines which orders are eligible for free shipping to live in one place. Maybe next week you want to change things up so that orders of over $100 are eligible for free shipping. Maybe you want to check on the shipping costs whenever an item is added to the cart, whenever an item is removed, and when the order is being processed. Keeping the “free shipping” expression in a method in the class about which the question will be asked is most likely the best spot.

Another benefit is that the code in the later example is more readable after refactoring than before. The expression is not self documenting, a method name like isEligibleForFreeShipping is.

I used to think of DRY in terms avoiding the use of copy and paste, but I think there’s even more value in making sure that business logic is never duplicated. Making sure that all of your business logic, even if it’s just one constant or a simple expression, exists in only one place in your application and writing proper unit tests for it prevents a lot of bugs of the most annoying kind.

The real trick is to make sure that you don’t lazily duplicate the logic yourself later on rather than remembering to use your convenience methods. I haven’t figured out the answer to that one yet.

How’s the iPhone?

Looks like the current reactions to the iPhone are about what I expected. People who are used to the Blackberry or other smart phones are annoyed by the features that they have to give up when using the iPhone. (See Dave Winer’s review.) People who have never carried a smart phone tend to be quite pleased with the iPhone experience. I imagine that’s was Apple’s goal. Rather than try to win over the hardcore Blackberry addicts, they wanted to build a smart phone for the much larger group of people who still haven’t jumped into the smart phone pond.

Links for July 25

I’ve been following the outage at the 365 Main data center in San Francisco. The speculation as to why the backup generators did not prevent the power outage from taking down some of the colo rooms in the data center is really interesting. Valleywag has blanket coverage of the story. Data center knowledge has a good explanation of the flywheel UPS technology that 365 Main uses, and how the outage might have caused it to fail.

Yahoo has released a cool extension for the Firebug debugging tool called YSlow that grades Web pages on download speed. If you want to raise your YSlow grade, you can follow Jeremy Zawodny’s instructions on adding good Expires headers with Apache.

Pakistani-American novelist Mohsin Hamid offers his explanation of why the United States is resented (and admired) overseas. Jim Henley explains that there are many complications involved with the “withdraw to Kurdistan” often bandied about as a potential next step in Iraq.

Weekly World News is shutting its doors.

And the obligatory iPhone link of the day describes the installation of the ssh server on an iPhone.

Grim housing news

How grim is the mortgage market right now? Check out these numbers from Countrywide Mortgage:

Countrywide said about 5.4 percent of the home equity loans to customers with good credit that it held an interest in were past due at the end of June, up from 2.2 percent at the end of June 2006. By comparison, more than a fifth of subprime loans were past due at the end of June, up from 13.4 percent a year ago.

The shenanigans that absurdly rapid real estate appreciation bred are going to be costing us for a long time to come. Now that the appreciation has disappeared, the chickens are coming home to roost.

On the other hand, if you are behind on your mortgage payments, I would strongly encourage you to call your lender and try to work it out. I would imagine that any borrower who has any hope of retaining their home and making the payments will receive leniency from their mortgage lender these days.

David Petraeus’ September progress report

General David Petraeus is supposed to issue a report in September that will assess how well the “surge” is going. The Washington Post has obtained a leaked copy of that report:

I meet with Iraqi security force leaders every day. Though some have given in to acts of intimidation, many are displaying courage and resilience in the face of repeated threats and attacks on them, their families and their comrades. I have seen their determination and their desire to assume the full burden of security tasks for Iraq.

There will be more tough times, frustration and disappointment along the way. It is likely that insurgent attacks will escalate as Iraq’s elections approach. Iraq’s security forces are, however, developing steadily and they are in the fight. Momentum has gathered in recent months. With strong Iraqi leaders out front and with continued coalition — and now NATO — support, this trend will continue. It will not be easy, but few worthwhile things are.

OK, I lied. That’s actually Petraeus’ progress report from September 2004, when he was in charge of building up the Iraqi Security Forces. Things in Iraq are better than they appear, and they always will be.

Thirty years from now

You know what I’m going to hate, if I’m still around? Thirty years from now, people will be talking about how we could have won in Iraq if only whichever President takes office in January, 2009 would have had the guts to see the war through.

Older posts

© 2024 rc3.org

Theme by Anders NorenUp ↑