«

»

Jun
16

From Smalltalk-80 to Objective-C

As some of you, I am working on my own kind of distribution. I have continuously posted screenshots on my page. For now, my main page is offline as I am restructuring information on it, I am also in the process of setting up an all new domain, devoted to the distribution project alone.

Some of you may also have gathered that not only I am working on my own distribution, but on my own desktop, or end user interface. It’s a big task all right, but it’s also fun to learn. In the end I’d be able to say that I learned these languages, but with this one I made something really big.

As I have progressed in Squeak and Smalltalk, and as I got down to serious business, I have noticed that there is a big slowdown happening, whenever you have more and more windows open, regardless if they have controls and elements inside them or not. Goes for Squeak’s SystemWindow implementation, as well as for my own framework inside which you can find CSMSWindow. It’s fine when you have one or two, but when you have like 5 or so, a slowdown is really noticable.


The Squeak VM running on X11

This has to do with the fact that processes of Morphic, Squeak’s current major graphical implementation, is not asynchronous. This means that the current active Morph (and thus a window) can have the processor’s full attention, while others stay behind. And this, my friends, is really lethal if you want to build your own end-user desktop interface.

So what are the options?

Contender #1: wxWidgets

Platform independet framework. Lets you write apps on almost any platform and then take it to another system with no or minor modifications. Many applications are written in it, mostly Linux X11 programs. The big advantage is its easyness, or so it is claimed by many. The disadvantage of it would be bearing no similarity to the code I already wrote. But then again if it is as easy as they claim, maybe it could be rewritten. Let’s quickly look at some code.

Creating a window takes some lines and 4 files. And the window has nothing in it.

While this is still impressive at the thinness of code, I was looking for other alternatives.

Contender #2: QT by Trolltech

Also platform independent, and has found roots in many things out there, most notably KDE. However, the site claims that Skype, Google Earth, Adobe Photoshop Elements and Lucasfilm are amongst their customers and use their framework in their applications. Well that surely sounds like something worth looking into, right? Let’s see how they do a little Hello World application, utilizing the framework. Turns out this is all you need.

Not so bad. Better than wxWidgets all right. 13 lines of code. Then run the QT compiler and it’ll do the rest for you. Awesome. Advantage appears to be that the code is amazingly thin, and can be used on all platforms. But again, my code wouldn’t be compatible, I’d have to start from scratch again.

There has to be something out there.

So that forced me to look, again. Look at possible alternatives, but this time I kept in mind that I know Smalltalk-80 pretty well by now. I have written my own UI framework in it. So. Smalltalk. It is object-oriented. And came from the early days. Is written in itself. All these things I kept in mind. After a thorough amount of search I came across something, which is the winner in this contest.

Contender #3: GNUstep

Platform indepedent. But who is using it, or what advantages does it have? I’m sure many of you out there have not heard about it.

It is important to understand where it comes from. Before Apple got to its glory it has today, there was NeXT, Inc. Founded by Your Steveness himself. They then developed an OS, named NEXTSTEP. This OS in turn had something no one else had back at the time – an object-oriented user interface backend and API. This means that back in 1992 when it came out first, it was so advanced, that you could compare it to Windows 2000.

It is also important to understand what made all that possible: Objective-C.

NeXT developed extensions to the C language, which would allow for the very same structuring and message parsing as it was already seen in Smalltalk. Objective-C in turn then used to build the NEXTSTEP user interface.

Shortly before Apple began developing Mac OS X, they purchased NeXT Inc. The base of NEXTSTEP then became the base of Mac OS X.

However NeXT made its protocols available to anyone, known as the OPENSTEP specification. And from that foundation, the GNUstep initiative was built.

What does this mean? This means: GNUstep shares the very same foundation as Mac OS X, while being platform independent. The language also is Objective-C, which is highly compatible with Smalltalk, as it served as the original for the new superset of C. Having that said, you could design and develop an application on GNUstep, then take the files to Mac OS X and compile it there – it will work.

This is why I am choosing GNUstep as my environment for expanding my code, and porting my code to it. It would also run directly on the chip of the machine, without a VM. But what impresses me the most, is that I can use the foundation of one of the most advanced systems in the world, and build my environment on it. In fact, on the development machine I set up, there already is a very similar environment to Mac OS X running, however for the moment I use WindowMaker with the NEXTSTEP look.

Let’s see what develops.




Related posts:

  1. Smalltalk really is a drug
  2. First COSMOS code released
  3. More on “COSMOS”
  4. KDE 4 dot zero is now available!
  5. Squeak, with Aero built-in.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>