New Car

September 30, 2007

Between not being able to purchase anything I couldn’t carry home and increasing annoyance with mediocre public transportation, I finally bit the bullet. 15 months in Cupertino without a car were enough. Yesterday morning, I picked up my new Honda Civic Hybrid with Navigation.

It feels surprisingly good just driving around. I had expected it to be a bit strange with so much time out of the driver seat, but that’s not been the case. And to the extent that I can be giddy, I am giddy about my newfound ability to get from place-to-place with ease. Trips that used to take over an hour by bus are now measured in minutes.

I’m also loving the navigation system. I’m pretty good with directions, but the navigation system lets you turn off your brain. Plus, I’m a bit of a statistics freak when it comes to traveling. I used the lap timer on my watch to keep track of travel time vs. pit stop time on family trips. Between the navigation and the hybrid statistics, that itch is scratched.


iPhone Ads

June 4, 2007

Apple has posted some new ads for the iPhone. It will be out June 29th.

Microsoft Surface

May 30, 2007

If this thing lives up to the potential demonstrated in the videos, it’s going be pretty awesome. The portable device integration looks fantastic. However, I become wary when Microsoft makes big promises, so my hopes are not too high that we’ll actually see it this winter.

Mars Panorama

March 18, 2007

Images from the Mars rover have been combined into a Quicktime VR panorama: Pretty awesome. It really gives you a feel for what it would be like on Mars.

The Sweetest Thing

February 16, 2007

A couple nights ago, I received The Sweetest Thing from Netflix. I was mildly disappointed – I couldn’t remember why I’d rented it, and was not expecting great things. However, I thought there might be some funny moments, as well as some pleasant sexiness from Cameron Diaz and Christina Applegate.

This movie is wicked bad. Truly awful. I made it through about 25 minutes before I gave up on it. Not only was it unfunny, but the Diaz/Applegate sexiness was only mildly pleasant.

If you’d like to challenge your sanity, try to make it beyond my limit. Through herculean effort, I made it to the penis song scene. In this scene, Selma Blair joins Diaz and Applegate at a cafe after bringing a semen-stained dress to the dry cleaners. (Note: the man at the dry cleaners licks the stain to determine its cause) After a moment or two of small talk, the girls and the cafe spontaneously break into a song about penises. And the topper – it wasn’t even a good penis song…

Too many lines

November 5, 2006

Microsoft Office for OS X has around 30 million lines of code. Damn.

Barack Obama is (not) the Antichrist

October 25, 2006

Things that makes me sad:

  1. That people believe in the antichrist
  2. That some believe it is Barack Obama

Blogging is Evil

October 15, 2006

According to the Restored Church of God blog, blogging is evil. Some choice quotes:

In effect, personal blogs are becoming a shopping catalog for pedophiles!

Because this article is extremely important, some may need to read it twice and use it as a stepping stone to further study on this subject.

Whether or not it is effective, as soon as something is posted the person has a larger voice. It often makes the blogger feel good or makes him feel as if his opinion counts—when it is mostly mindless blather!

Stop and consider. The biggest mark you will ever make is to build God’s character and be born into the God Family. Blogging will not help you achieve this.

This makes me sad. Is a god so pathetic that he needs us to build his character worthy of worship?

If you post mundane details of your life, you are in effect saying that your life is important and that people should read about it.

My life is important. So is yours.

One blog by a young twentysomething in a splinter used the acronym “OMG,” which is a shorthand way to take God’s name in vain … There should never be a need to use slang or any type of wrong words.

How do you think God feels about the mindless blogging that is occurring?

I don’t think any gods would give a damn. I certainly wouldn’t were I omnipotent.

“I used to wait tables at Hooters”! Although she may not have been familiar with God’s Way at the time of that employment, and so may not have known that this was wrong, she still should be discreet.

It’s wrong to tell people you used to work at Hooters?

Some say illicit drugs are therapeutic—does that mean they should be used? Obviously not.

Not obvious at all.

We must do everything in our power to be concerned with how we appear to others. If they come to the wrong conclusion, it may hurt your reputation or badly reflect on God’s people.

Let me emphasize that no one—including adults—should have a blog or personal website

What a stupid goddamn religion.

Six Easy Tips for More Maintainable Code

October 8, 2006

I’ve recently had the opportunity to work with a large, unfamiliar code-base. The experience has made me reflect on some of my own coding practices and on writing more maintainable code. Much has been written on this topic, but here are the things that I feel are most important and have a high payoff without much (if any) additional work.

Make use of inherent metadata

Programming languages have inherent metadata in how you name things, what types you use, scoping, visibility, etc. This information is invaluable for someone new looking at the code and helps make the code self-documenting. There are several things you can do here:

Use good names

  1. Give classes, variables, methods, functions, etc. descriptive, differentiable names. Things that are related should have similar names, while things that are not should not.
  2. Keep the names up-to-date. If functionality changes, update the name.
  3. Variables with different scopes should be differentiated. For example, prefix instance variables with an underscore.
  4. Be consistent.
  5. Don’t create variables for things you only use once – just put them inline. Then I don’t have to figure out where else the variable is used.

Use appropriate types

  1. If possible, don’t use multi-level typedefs. It’s a real pain in the ass to go through 5 header files to figure out that foo_bar is an unsigned integer. And don’t typedef pointers away – I want to know if something is a pointer or not. Especially don’t typedef pointers away by inventing your own syntax (e.g. CFArrayRef is a CFArray pointer). The language already has syntax for that.
  2. Do use typedefs for things like enums.
  3. Use the most-specific type possible. If something should not be negative, make it unsigned, etc.

Use appropriate visibility

If something should only be used within a class, make it private. People looking at the code then don’t need to worry about external clients.

Keep things short

Nothing is more depressing than trying to grok a long method/function/class. There shouldn’t be hard rules on length, but I try to write methods/functions that fit on one screen, and to keep my classes under around 1000 lines of code. Without caution, this can lead to a method/class explosion, but I’d rather grok a small class cluster than one gigantic class.

Keep block nesting to a minimum

Don’t have a while loop inside an if, inside an else, inside a for loop, inside an else if, inside an do/while loop, inside a …

Reduce coupling

If I have to understand more than a small portion of the code to change one class, there is a problem.

Write useful documentation

You don’t need a lot. Here is what I think is important:

  1. Describe briefly what a method/function does. No method or function should be so complicated that this is more than a sentence or two.
  2. If a method is overriding a superclass, note that and explain why.
  3. Explain anything unusual or complicated.
  4. If a method has concurrency issues (should only run on the main thread, etc), note those.

Think of those that come after you

Whenever you write some code, try to put yourself in the shoes of the next programmer to work on the code. This is the programmer’s version of the seven generations rule.

The Bus Theory of Campaign Finance Reform

September 18, 2006

Democratic and Republication strategists are estimating that each candidate could spend $500 million dollars on the 2008 presidential election. This is obscene. Here is my proposal for campaign finance reform.

Anyone who wants to run for President and meets the eligibility requirements registers with the government. A number of months before the election, they would board one or more buses, holding town hall style debates across the country. The current sitting President could join them at any of the debates he/she saw fit. A token fee from each candidate, along with government money, would pay for the buses, lodging, etc. This would be the extent of campaigning the candidates are allowed.

The hole in this scheme is that political action groups and private citizens can fund ads on their own, completely independently from the candidates. The first amendment allows them to say what they want. However, given that the public owns the airways, the FCC could prevent broadcast stations from accepting and playing these ads. Further, one would hope that the tremendous quantity of public debates would drown out the ads.

The important points of this scheme:

  1. Anyone with the interest and ability to raise a couple thousand dollars can run. This would encourage third parties and promote political diversity.
  2. The candidates always appear together in a debate setting, giving citizens the opportunity to interact with all of the candidates in a fully dynamic setting. No more carefully staged events.
  3. The common transport on the buses would allow constant interaction between the candidates. Hopefully, this would result in idea exchange, particularly from the minor parties to the major parties.
  4. Anyone who did not drop out during the campaign would appear on the ballots in all states.
  5. The equal time laws should be enforced for all candidates and all print or broadcast media.
  6. This idea could be extended to apply to other national or state elections as well.