8 Posts for July 2007

Why I'm Not Doing Anything

Posted July 31, 2007

Recently I haven’t been very active in the various projects I’m involved with. I’ve been doing stuff like applying patches and fixing minor bugs for Haml, but no major development. I’ve answered a few make_resourceful questions on the mailing list, but haven’t touched the code. I’ve barely even thought about Scribble. I’ve even been negligent in my blog posts; this is my first post in over a week.

This isn’t because I’m losing interest or anything; on the contrary, I’d love to spend more time working on this stuff. I just don’t have more time. Microsoft takes up a good ten hours every weekday (eight hours there and an hour-long commute each way). I’m a zombie if I don’t get enough sleep. That doesn’t leave me with a lot of free time.

What time I do have, on weekends and squeezed in on weekdays, I’ve been spending (perhaps foolishly) on a personal project. I’m not ready to unveil it yet, although I’ve talked to some folks about it. It may never see the light of day at all. But it’s fun to work on, so it’s also been sucking my time.

Books
Tags

It Is Done

Posted July 22, 2007

I have received and finished Harry Potter, at the cost of staying up all night reading (something I reserve for occasions like this). It was very good, and did an admirable job of wrapping up the series. I must say I’m still in a little bit of shock that the series is over at all. It’s such a vivid mythos, it seems like it can’t just end. I’ve grown up with Harry Potter. It’s bizarre.

Also an interesting bit of trivia I noticed (non-spoiling, I promise): the last book takes place the year the first book was published. It’s mentioned indirectly that Harry was born in 1980, and in the book he turns seventeen. That places the date at 1997, the year Harry Potter and the (Philosoph|Sorcer)er’s Stone was published.

Books
Tags

Harry Potter

Posted July 21, 2007

As I’m sure everyone is aware, Harry Potter just came out (checks clock) ten minutes ago. I don’t have a copy; I’m not quite hardcore enough to go out at midnight and get one. Nevertheless, I have pre-ordered one, and it should be arriving at my house sometime today. Last book, it came around noon. From the moment I get it to the moment I finish, I will be completely detached from the internet. This is both to avoid spoilers and ensure that I keep at my reading.

I’ll be sure to post here when I finish. Don’t worry, though; no spoilers!

Object-Orientedness vs. Duck Typing

Posted July 18, 2007

Yesterday I was thinking about object systems and the difference between methods and functions when I stumbled upon a very strange conclusion. It seems to me that any object-oriented system is fundamentally just a little at odds with duck typing. Clearly it’s possible to reconcile the two; both Ruby and Python do a fine job. But there’s a very interesting tension there.

To see what I mean, think about the difference between a method of an object and an ordinary global function. Really all a method is is a function that takes an instance of an object to be the “self” of the function.

This can be done explicitly, as with Python’s “self” argument for every method, or implicitly, as with Ruby’s “self” keyword and scope. You can even do it explicitly in Ruby if you want. For example, the two methods below are the same in everything but syntax:

class Array
                  def middle
                    self[length / 2]
                  end
                end
              
Books
Tags

Quines II

Posted July 15, 2007

In my first real post, I mentioned that I was reading Gödel, Escher, Bach: an Eternal Golden Braid, by Douglas Hofstadter. I promised that as soon as I got to the section on quines (the subject of that first post) I’d write a followup about what Hofstadter thought about self-replicating programs. Unfortunately, I read right through that section, entirely forgetting about my promise. In this post I plan to atone for my forgetfulness and talk about Hofstadter’s take on quines, but only after taking a few paragraphs to wax enthusiastic about the book.

I first remember hearing about GEB from my intro computer science instructor. He said that it’s the kind of book everyone’s begun at one point or another, but that almost no one ever makes it all the way through. This isn’t that surprising; the book is 742 pages long, not counting the notes, index, or annotated bibliography. When my parents bought it for me this winter, then, of course I had to make sure I read it cover to cover. As soon as I finished the book I was reading at the time, I picked it up and vowed not to start another book until I had finished GEB.

At long last, after seven months of sneaking a few pages wherever I could, all too often long after I should have been asleep1, that time has come. On Friday the thirteenth of July, 2007, I read the final page of the final (hilarious) dialog between Achilles, Mr. Tortoise, the Crab, the Author, Charles Babbage, and Alan Turing. Moreover, I had successfully managed to avoid reading another book during the entire time2 I was reading GEB.

New Blog (Engine) Soon

Posted July 13, 2007

As some folks may know, the engine on which this blog runs was written by myself. However, the code was not the prettiest thing ever to grace the tubes. I wrote it in a nice, RESTful manner, but as I noticed that I was repeating a large amount of code, I tried to abstract it out into various separate methods. The result ended up being rather messy. But then I moved on to other projects and left the engine as “good enough.”

A little over a month or ago, though, I decided it was high time to revise it. I’m very fond of the idea of revising code. In the best English course I ever took, we talked about the idea of “revision.” The professor explained that revision was literally the process of seeing your text again: “re,” meaning again, and “visio,” the same root from which comes “vision.” After just getting all your ideas down on paper, you take a step back and read them from the perspective not of the author, who by definition already understands everything that’s going on, but of a reader. This allows you to see weaknesses and potential strengths in a way that was impossible before.

The same principle applies to code. Once it’s written, it’s quite effective to take a step back and adjust your perspective. So I did for my blog; I essentially dumped all my REST-abstracting code in favor of make_resourceful, added a bunch of specs, and generally made the code cleaner, smaller, and more readable.

Haml 1.7 (and 2.0)

Posted July 8, 2007

Haml 1.7 has been officially released!

This is very exciting. There are tons of cool features and a really awesome speed boost, but those are all covered in the release notes. I want to talk about what this means for Haml development.

The next Haml release is going to be version 2.0. As such, we’ve skipped over version 1.8 and made the current development version 1.91. Because it’s going to be a full-version release, we want to make it a really impressive piece of software.

Tabs Versus Spaces

Posted July 5, 2007

Recently, I was talking with Will Farrington about that age-old debate, whether to use tabs or spaces to indent code. As a religious war, it would seem that there can be no resolution; the opposing factions are doomed to disagree1. However, I believe that despite the religious nature of the issue, I have found a resolution.

For the uninitiate, a “hard tab” is the character that appears when you press the Tab key in most programs. When writing code, indentation is used to make the structure of the code more clear. For example:

def print_each(list)
  # The inside of a function is indented
  for entry in list
    # The inside of a loop within the function is indented again
    puts entry
  end
end

There’s considerable debate over whether it’s preferable to use one tab for each level of indentation or several spaces. The arguments both for spaces and for tabs have already been covered more than amply, so I won’t bother going over them.