More and more, it’s becoming apparent to me that we live in a world full of self reference and recursion, meta data and aggregators, collaboration and user generated content. Think about it for a second. Our world is full of recursive, self-referential examples. A movie trailer (a movie about the movie itself), blogs about blogging, meta-data (data about data), a YouTube video about YouTube. The examples go on and on.

I’ve recently begun thinking about these topics because of the book I am a Strange Loop. In it, Dogulas Hofstadter argues that consciousness arises as we become aware of the world, and therefore become aware of ourselves, and therefore become aware of ourselves being aware of ourselves being aware of the world, and therefore… on and on. This self reference cycle (referred to as a strange loop by Hofstadter) may, in fact, be the key to consciousness itself. Is the concept of “I” simply a recursive definition within the framework of our minds? I don’t know, but I do know that I really like this book.

On top of this, I recently stumbled across the YouTube video The Machine is Us/ing Us. In it, the author explains the elusive concept of Web2.0 by using Web2.0 tools. This bizarre and interesting approach seems to hit the nail on the head for me. Watch it a couple of times. Very cool.

I would say that the web is becoming more powerful now not simply because technology is advancing but because the way we think about thinking is changing. It seems to me that data itself is becoming less important than the ways in which the data is tracked, compiled, compared and communicated. To sum it all up, I leave you with this nifty phrase from Hofstadter’s book:

“preceded by itself in quotes forms a full sentence” preceded by itself in quotes forms a full sentence.

For more information, please see this article.

Update: A reader has added my post to his “lens” about strange-loops. I wasn’t familiar with lenses until today, but they seems to be a type of data aggregator, which I find very fitting. A web page containing information about web pages containing information about strange loops. What could be a more perfect self-referential showcase for this article?


Ruby has open classes. “Who cares?” you say. You should. Yes you! Open classes really simplify a lot of programming problems when you can learn to use them correctly. First and foremost, what does it mean to have open classes? Well, this means that you, the programmer, can crack open ANY class and add methods to your heart’s desire! And nothing is off limits. This means I can break into the Integer class, add a helpful method for my program, and sneak out again without anyone being the wiser.

So how would one use the the fiendishly clever practice of open classes in every day coding? Here’s an example of a problem I ran into while working on project euler problems:

I often found that I needed to know the number of digits in an Integer for solving these problems. Let’s say I want to get the sum of the number of digits in all the numbers 1..100. Here’s the old way:

Old Way

Now this is all fine and dandy and the code works great. However, there is a logical conundrum here. Why is num_digits just hanging out there by itself? We know that this method will always be called on Integers and, therefore, it makes much more sense to add a new instance method to the Integer class. Ruby open classes to the rescue!

Super fabulous open classes way!

Ahh, I feel so much better, don’t you? The only subtlety here is that we’re using self inside our num_digits method. This simply references the instance of the integer we are currently dealing with. So remember, next time you find yourself writing a method that would be better suited as an instance method of a class, break on in there! Ruby classes aren’t shy.