I’ve been playing with Ruby a little and there’s one feature in Ruby that I particularly like: the ability to extend existing classes. For example, for as long as I’ve been programming using objects I wanted to add a method to integers called “timesSayZef”. So you could do this:

100.timesSayZef()

And it would print “Zef” a hundred times. However, Java doesn’t allow you to do this, C# doesn’t allow you to do this, even Python doesn’t allow you to do this (at least I couldn’t get it to do it). However, Ruby does with this code:

class Fixnum
   def timesSayZef
      times { puts "Zef" }
   end
end

In Ruby when you define a class that already exists (such as Fixnum, which represents a number, such as 100), it will merge the two definitions. So in this case I would add a timesSayZef method to the Fixnum class. When I now do this:

10.timesSayZef

it will print:

Zef
Zef
Zef
Zef
Zef
Zef
Zef
Zef
Zef
Zef

Cool huh?

Ruby also allows you to extend existing objects with additional methods. For example:

class BoringClass
   def saySomething
      puts 'Something'
   end
end
module ZefStuff
   def sayZefIsCool
      puts 'Zef is cool!'
   end
end
bc = BoringClass.new
bc.saySomething
bc.extend(ZefStuff)
bc.sayZefIsCool

What I do here is first define a class. Then define a module. Create an instance of the class and then extend that instance with all the methods in the module. This example will print:

Something
Zef is cool!

Research Internship

by Zef Hemel

I’ll be spending the next ten weeks doing a full-time research internship at my university (University of Groningen). In the software engineering research group they work on a so-called Architecture Description Language (ADL) based on Java called “Archium”:http://www.archium.net. This language is based on the idea that the design process of software actually consists of a sequence of design decissions. Examples of design decissions are the database server you’re going to use, whether your server is going to be single or multi-threaded, or even what the base colour of your GUI will be.

When you design your software a lot of such decisssions are made, however hardly ever well-documented. What you end up with is an architecture document showing the end-result saying that you’ll be using SQL Server, a multi-threaded server and a pink GUI. The reasons behind those decissions are often not written down.

If the architect gets run-over by a truck you’ll lose all the reasoning behind the decissions made. Why did he choose to use SQL Server and not MySQL? What would happen if you change it? Was his choice for a pink GUI only based on his gayness or did the customer specifically request it? Nobody knows. Archium lets you write down the rationales behind such decissions so that they are kept for the next generation of architects, or even for the architect himself when he has to change something in the design, a couple of years later.

Because software architectures often are quite complex, people developed different ways of looking at it. It’s like normal architecture, somebody who has to paint the walls is interested in very different things than somebody who has to make sure the building won’t collapse. Sometimes you’re interested in getting a very global overview of what the different parts of the systems are, sometimes you want to know which components are connected, sometimes you want to know exactly which class is in which file. Right now Archium only supports the component and connector viewtype. This view shows the different components and how they are connected; who talks to whom.

My job is to add an additional viewtype: the module viewtype. The module viewtype is a lot like namespaces in C++ and C# and packages in Java. My job is to figure out how Java’s package system differs from the module viewtype and how to bridge this gap. Then I have to figure out how this will affect the Archium system. Today (and this weekend) I’ve been reading the first five chapters of “Documenting Software Architectures, Views and Beyond”, some papers written about Archium. I’ve also made a list of the views that Archium will have to support and which are already supported by Java.

Because this is a 9-5 job I might not have much energy left to post every day. Oh, and for those ever being near the IWI building, pop in some time. I’ll be in IWI 10 most of the time.

I think I’ll be looking into Ruby a little more, frameworks like Ruby on Rails and features like “modules”:http://www.rubycentral.com/book/tut_modules.html make it quite appealing. For the occasion I collected a couple of Python vs Ruby links:

* “Python Vs Ruby”:http://c2.com/cgi/wiki?PythonVsRuby: an extensive C2 Wiki page about the subject.
* “A comparison of object oriented scripting languages: Python and Ruby”:http://www.cs.washington.edu/homes/kd/courses/pythonruby.pdf a paper on the subject
* “Comparing and Introducing Ruby”:http://www.ntecs.de/old-hp/s-direktnet/rb/download_ruby.html
* “Python and Ruby”:http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc: looking at the fundamental differences between Ruby and Python
* “Linguistic Simplicity”:http://toulouse.amber.org/archives/2003/08/21/linguistic_simplicity.html#003032

Google and MySQL?

by Zef Hemel

A new project just popped up on “Google’s Open Source website”:http://code.google.com: “Google mMaim”:http://goog-mmaim.sourceforge.net. mMaim is, according to the website:

mMAIM stands for MySQL Monitoring And Investigation Module mMAIM’s purpose is to make a it easy to monitor and analyze MySQL servers and to easily integrate itself into any environment. It can show Master/Slave sync stats, some efficiency stats, can return statistics from most of the “show” commands and more.

What does Google use MySQL for? It definately doesn’t store its search index in it, or your Gmail e-mails, so what does Google use it for? Or has Google all of the sudden turned into a company that supports any open source project, regardless if they profit from it or not? Google’s also going to the “MySQL User Conference”:http://mysqluc05.blogspot.com.

So, what do they use it for? Customer Relation Managament, Human Resource Management? Just curious.

TINE and MacExpo

by Zef Hemel

Today I, and three friends, went to TINE, The Internet and Networking Event, Holland’s biggest IT event (supposedly) and to MacExpo.

On the TINE website it says that TINE would take up two of the three halls of the RAI, a huge event hall, and MacExpo would take up one hall. I and a couple of others went to TINE last year and didn’t really like enough for a total of around 5 hours travelling by train, but now that MacExpo would be there, we decided to go.

It was crap.

TINE was just like last year. Dozens of stands from unknown IT companies with employees in suits talking to each other. The biggest stand was from Microsoft, but not much happened there either. After having walked through the TINE halls all that had changed in our lives was that we lost an hour we wouldn’t ever get back, and that our bags were much heavier because of all the advertisements and magazines that people pushed in our hands. And polite as we are, we didn’t throw them away immediately.

So, we set our hopes on MacExpo. An event that had taken place on other places in Europe before and supposedly was great there. Nu such luck, though. We were promised one hall full of Mac stuff, we got barely one third of a hall.

The Huge MacExpo
(This was the MacExpo)

On the map of the three halls that looks like this (I think, I could have missed a part though):
On the map

There were a lot of macs there and quite some software, but nearly all the stands were from Apple resellers. Apple itself wasn’t even present. Feeling sad we decided to then at least buy a box of “iPod socks”:http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?productLearnMore=M9720G/A.

They were sold out.

New Pope

by Zef Hemel

Well, since a couple of minutes we have a new pope. His name is Joseph Ratzinger, a German cardinal. He’ll be named Benedict the 16th.

Being a Roman Catholic myself, I have no reason to be happy about this. Ratzinger is said to be very conservative, very against gays and in general: bad news. Much worse than John Paul the 2nd.

Pope Benedict XVI

* “CNN Article”:http://www.cnn.com/2005/WORLD/europe/04/19/pope.tuesday/index.html
* “Reuters Article”:http://www.reuters.com/newsArticle.jhtml;jsessionid=R4FCGKLPHUJXMCRBAEZSFFA?type=topNews&storyID=8228572

GoboLinux

by Zef Hemel

Ever since I’ve started using Unix systems I always asked myself one question: if this Unix stuff is so great, why are all your applications scattered around the whole system and not put neatly into one directory per application?

This question became stronger when I first met Mac OS X. They’re doing exactly that: all applications are in /Applications/appname.app. You can install applications by simly dragging them into the /Applications directory, no installers (usually), just drag-and-drop. Yesterday I found out that this way of structuring your filesystem originates from “NextStep”:http://en.wikipedia.org/wiki/NextStep, a company that was bought by Apple around 1997, which on its turn used it to base its tenth version of Mac OS on.

Ever since I started using OS X I wondered: would it be possible to have a Linux distribution based on this concept? Just a neat filesystem in which you can install and uninstall software by simply using cp and rm? Or xcopy-deployment as Microsoft calls it. However, at that point I didn’t consider myself knowledgeable enough about Linux to give it a shot.

This morning, when I searched for a Linux distribution based on “GNUStep”:http://www.gnustep.org, a free implementation of OpenStep (which is a standardized version of NextStep), I found “GoboLinux”:http://www.gobolinux.org. GoboLinux is a Linux distribution like any other, except that it uses a totally different filesystem lay-out, one fairly similar to NextStep and therefore Mac OS X.

The basic structure of applications is: /Programs/AppName/versionnumber/… this allows for multiple versions of an application or library to be installed. In order to make programs easily runnable (i.e. easier than running them by typing /Programs/OpenOffice/1.1/bin/openoffice every time), symlinks are created from /System/Links/Executables which is on each user’s path (like /usr/bin on normal Unix systems). GoboLinux also contains scripts to easily port normal Linux software to a GoboLinux-like file structure.

It definately looks like an interesting project. I’m downloading the ISO right now (which is also a LiveCD, so I can easily test it). “Read an introduction to the ideas behind GoboLinux here.”:http://www.kuro5hin.org/story/2003/5/9/05015/62649

Next Page »