rc3.org

Strong opinions, weakly held

Month: October 2006 (page 2 of 2)

Trying to grok the mobile phone generation

I keep reading that the computing platform for the younger generation is the mobile phone. For me and my generation, it’s the personal computer. I see the mobile phone mostly as an annoyance. I loathe texting, I don’t really care for voice mail, and I certainly don’t want to talk on the phone unless I absolutely have to.

Reportedly other people don’t see their phones that way. They text constantly, use their phones to surf the web, and generally use the phone as their communications platform of choice. I don’t get it, but there you go.

I will be watching with interest to see whether Twitter takes off and which sorts of people use it. It’s a service that enables you to send text messages from a mobile phone to a central service which then passes them along to your subscribers. Naturally you can subscribe to other people as well. So if you and your five friends all joined and subscribe to one another, you could text a message to Twitter saying, “headed 2 bar after work” and your friends would be notified automatically. In other words, totally useless to me but perhaps intriguing to others.

I’ll be watching to find out whether that’s the case.

Use constants instead of string literals

One practice that I internalized a long time ago but that I still see a lot of experienced developers ignore is habitual . Most applications have common strings that are used in a number of places. These should pretty much always be stored in constants (however your language of choice implements them) rather than appearing as string literals anywhere other than when they are initially assigned. For example, a blog publishing tool might have a status field for posts with possible values of “published”, “draft”, and “scheduled”.

If you’re writing Java, you might write code like this:

blogPost.setStatus("published");

and

if (blogPost.getStatus().equals("published")) {

     // do stuff }

The reason this is bad practice (even though it works like a charm) is that it costs you an opportunity to let the compiler do work for you. Let’s say you write your code like this:

public static final String STATUS_PUBLISHED = "published";

blogPost.setStatus(STATUS_PUBLISHED);

if (blogPost.getStatus().equals(STATUS_PUBLISHED)) {
    // do stuff
}

If there’s a typo in that code, the compiler will catch it for me. Typos in string literals are the cause of a huge number of difficult to diagnose bugs, and are easy to avoid. There are other advantages to this approach as well, especially if you use an IDE like Eclipse. If put a string in a constant, I can use the “References” feature in Eclipse to show me every spot in my code where the constant appears. In a couple of seconds, I can discover every place in my application where the status of a blog post is set to “published”. There are all sorts of other advantages as well, like being able to rename the constant using the rename variable refactoring in the IDE as opposed to search and replace.

This practice is on my mind this week because I finally bothered to learn about Ruby constants, which are incredibly easy to declare and enable me to apply the same practice that I always use when programming in Java.

To create the same constant in Ruby, you’d just type:

STATUS_PUBLISHED = "published"

You can, of course, reference it by name, and if it’s declared in a class called BlogPost, you can reference it like this:

if status == BlogPost::STATUS_PUBLISHED
    # do stuff
end

Ruby will happily show you an error message if you reference that constant without declaring it first, so even though Ruby is looser in terms of variable declarations than Java, the compiler will still help you out in situations like this.

PHP also has constants but in my opinion the declaration syntax makes them a pain to deal with. (I still use them when I’m programming in PHP, though.)

Movable Type and Atom feed upgraded

This morning I actually took the time to update Movable Type to version 3.33 and I updated the template for the Atom feed from version 0.3 to version 1.0 (a long overdue change).

I’m also getting rid of the RSS 1.0 feed (found at /index.rdf) and soon I’ll probably move the Atom feed to /index.xml and retire the RSS feed.

Update: How do you get Redirect directives to work with the rewrite tricks that Movable Type requires in your .htaccess file? My redirect for the RDF index isn’t working at all, I assume because the rewrite rule is eating all of the requests.

More on free upgrades and social media

Rebecca Blood has some interesting points to add to my post about how operational upgrades work at airlines (and how the Internet works at disseminating information). She also has some flattering things to say about me, but you can ignore that part since you probably have your own opinion about how wonderful (or horrible) I am.

Getting free upgrades on airlines

Today I saw a pointer to a forum posting at flyertalk.com from DullesJason, a former gate agent for United Airlines. In it he explains how gate agents for United are supposed to assign “operational upgrades,” otherwise known among passengers as getting bumped to first class. There’s a lot of lore about the best way to put yourself in position to get such upgrades, most of it driven by the idea that it is completely up to the gate agents who they choose, and that the best approach to getting an upgrade is to suck up. DullesJason says that’s not so, and provides plenty of details about how they actually are handed out. Here’s a snippet:

Operational Upgrades are given on the basis of status and fare paid! Not personal discretion. On the rare occasion when a Global Services (UA’s top-tier) passenger was planning to fly trans-pac in Y and didn’t already upgrade, we would go look at our elite list in the computer and find a GS member is Y+. Bam! The GS passenger has been moved to C. That’s 62 expected in C (up from 61 booked), presuming all C passengers show up.

Of course, the gritty details are much more interesting. (He actually provides a lengthy hypothetical explaining how upgrades are handed out for an overseas flight that’s overbooked for coach but has seats available in first and business classes).

This post must be worth a million dollars to United Airlines. In one fell swoop, he disabuses airline customers of the notion that being a nuisance at the gate will help you get upgrades, and more importantly, that the handing out of these upgrades is completely arbitrary. Instead he confirms that the best way to get free service from the airline is to be a loyal customer who gives the airline lots of cash. The airlines make all their money on loyal customers who give them lots of cash, so this is the best kind of publicity they can get.

No marketing information on all of the airline web sites in the world could convince me of the value of attaining an elite status and then sticking with that airline as well as this one forum posting has. Such is the power of the Internet, where one authentic voice can outdo all of the marketing dollars a company can spend. Ironically, DullesJason doesn’t work for the airline any more. He quit because the pay sucked for the amount of work involved. Maybe United ought to hire him back.

Newer posts

© 2024 rc3.org

Theme by Anders NorenUp ↑