13 December, 2007

Now, what about that smalltalk?

How to walk the (small)talk

Trying to learn programming isn't one of the easiest pursuits in the world, especially to me. In fact, I'm finding about the only real language as such that I have any proficiency in is the bash scripting language. Wonderful, that. In comparison to big brothers such as perl, ruby, or even tcl, bash doesn't have a whole lot to offer except the ability to string things together using pipes, and call external programs. It at least has arrays which is something, I suppose; I've made use of arrays in some of the bash scripts I've tailored for myself, as well as something called Indirect references (in essence, pointers, but in bash instead of C). That made my life a whole lot easier writing the programs I have, as I could simply wrap something in a mildly complicated forloop instead of hammering it all out into a temp file, then slurping in that temp file as part of the execution of the script. It's best ... avoided.

But this isn't really why I'm here. After all, I talk about smalltalk. A lot. It hasn't overtaken my life yet, though I'll bet that plenty of 'talkers could say that it has for them—it being a just-about-complete development environment in addition to being an environment for running applications. Yes, in comparison to the big IDEs (namely Visual Studio, KDevelop, Eclipse, NetBeans) the smalltalk development environment can be seen as primitive, but then so is a text editor and gcc+make, which is my normal fare. And nobody would argue that at least they get the job done. I'm sure you're mostly aware of the typical development cycle of "create, compile, test, break, fix, compile, test...", and the attempts of the big IDEs to put that all in one place; some more successfully than others.

One look for me, another look for you

In comparison to the "one window to do everything" approach of some IDEs, it seems that the smalltalk environment has one place to enter code (either of the System Browser or Debugger), a place to execute code (the Workspace), a place to view variables while the program is running (Inspector/Explorer) and yet another place to view output (the Transcript, or simply World). Sounds as inefficient as heck, and yet there's a certain sparse beauty to it. In the end, it does make sense to have various functions separated from each other. After all, you don't typically use your email client to do your budget, nor do you attempt to use your spreadsheet to send an email - there's separation of function. Otherwise we'd never get any work done.

However, in the smalltalk world, there's less separation than what I've mentioned here, as you can literally view every program's code in a smalltalk environment, all at once. If you want, you can even lock down aspects of the environment so that it acts more like a single application, rather than an environment to run a whole lot of applications. However, the normal use of smalltalk is to have everything turned on; that way you can fix something then and there if it breaks, and you happen to know how to fix it. To extend the metaphor a bit, it's a bit like having Internet Explorer being the front end to the entire source code of Microsoft Office, Windows XP/Vista, Messenger, Media Player, Outlook Express, and even IE itself. Of course this will never happen in the Microsoft world, but you get my point.

What? There are locks here?

To provide an example of locking down the Squeak environment to make it act like a single application instead, I mention a commercial offering built in Squeak: Plopp. Yes, this funny sounding name is actually an application built in squeak. And no, it's not explorable in quite the same way as a normal Smalltalk environment - it's been built to be an application, after all, and the company doesn't want just anyone browsing their crown jewels. So what's been stripped out? Most of the stuff that make Squeak what it is: an excellent development environment. The browsers have (presumably, at least) all been removed, as has the debugger, Inspector, and anything else normally associated with development. What's been left in? Great graphics (they're 3D!), and sound support, all based upon the Croquet 3D version of Squeak, an immersive world where you can spend time making drawings in 3d. The program is aimed at children, so it just has to be simple to use, that's why everything else that would get in the way of children enjoying themselves has been removed.

Je ne parlez petit parlez-pas

I came up against a small conundrum the other day. I wanted to run some code and view some variables while the code was running, but I didn't want to wreck a working codebase, which is what I had. I merely wanted to tweak, play, as it were. I couldn't find a way of doing that, without cloning the whole image and playing in that instead, with the ability of exiting without saving. It's the Smalltalk way, though I've got to still get used to that. I also couldn't start a program THEN invoke the debugger on the program, because I still don't know how to do that. The Debugger window is about the closest to what I want, yet I'm still hamstrung by what I mentioned at the beginning of this post - my lack of proficiency. And that's not just proficiency with smalltalk, or else I'd just get over it, and do the hard yards.

Instead, it's the lack of knowledge about programming in general - what works, what doesn't, how to do really really common stuff that professional programmers take for granted. Stuff like lists, sorting, filereading, and output to screen being some examples. I don't know how to do most of that in any language I know.

A useful idea I came across quite a few years ago in a related subject is the "Whole language" method of learning - in effect, chucking the subject in the deep end, and making their brain find connections for itself without the crutch of a translator to ease the process and hold back the progress. To address my attempt to learn programming, this is what I'd like to try for six months or so.

I'd like to simply boot into a Smalltalk environment, use it to run smalltalk applications, debug code, save files and so on, then get back to booting to my regular Linux. I can't quite do that with Visual Studio, although some people would say that emacs comes the closest to that under Unix-like platforms. However, there's a problem with trying to do that with Smalltalk at the moment. At this stage, I can't boot into a Smalltalk without additionally having to boot an operating system underneath to supply what the smalltalk environment doesn't. And normally, that's quite a bit.

The closest that Squeak comes (and it's not working well enough yet to be a viable alternative) is an alternative called SqueakNOS (No Operating System). In essence, what they've added to Squeak acts like the rest of the normal operating system, providing services such as reading from disk, writing to input and output ports for controlling items, and generally doing all the things we'd expect the normal operating system kernel to do. It hasn't quite got there yet, as all this code has to run through the VM, which itself sits on top of its ... yeah, well let's say it's messy. The critical thing, at least for me at the moment, is this: SqueakNOS can't write itself back to disk yet. The other point seems to be that nobody's really that interested in it at the moment, so it's not being maintained. The latest example I can get my hands on was released over three years ago, and is showing its age, compared to modern Squeak environments.

So for the moment at least, I'll just have to go with the "run Smalltalk as an application on top of the OS" and be aware that things aren't quite all there yet. Besides which, I can gain the benefit then of running multiple Smalltalk VMs side by side, and study how they differ in their implementations. Fun ones to compare for me have been Cincom VisualWorks (now up to version 8) and Smalltalk/X (now up to version 5.3.4, at least for the Windows platform), as they both present similar interfaces to the user, both of them using the underlying windowing system of the operating system to manage windows; I mentioned this in a previous post.

I believe that other Smalltalk environments (VisualAge being an example) also present themselves in a similar manner; I actually downloaded Dolphin Smalltalk to compare that. Given that it only runs under Windows, it's a somewhat unfair comparison to other smalltalks that run under multiple platforms. I've also avoided downloading anything that costs, as I can't buy it or justify the price of purchasing. Have you seen the per-seat price for Visual Age recently? Don't expect much change out of $7,500 if you want to use it in any significant capacity.

No cute dummy here - more a powerful force in its own environment

Now, into Dolphin. It's ... well, a rather well written program, and what appears to be a rather well written smalltalk. The class library is huge, even in comparison to other smalltalks I've used, and has most items that the average beginning programmer would want. I've yet to play with Dolphin some more, as I have to keep booting back into Windows to start it up.

Recent events and decisions have meant that the original authors of Dolphin have decided not to continue development on Dolphin, and as they have a serious bias against allowing the project to fall into the open source world, we aren't likely to see it made freeware any time soon unless someone does what happened to Blender (bought for $75,000). Frankly I hope that works, as I'd be VERY interested to see it tweaked even further.

This isn't a small talk, is it?

No it doesn't seem to have remained that. Frankly if I think about it, Smalltalk is chickenfeed in comparison to other languages such as Java, .NET or even C and C++. Yet Smalltalk presumably shaped the way interfaces were made, was possibly the driving force behind true object oriented programming, and hasn't gone away yet, even against the heavyweights mentioned before. It's not easy to learn, yet from learning it, there may be valuable aspects that will apply to other areas of programming. In saying that, there are apparently negative aspects to thinking Small, in that if you think in that manner, you're automatically counting out other ways of working that may actually fit the current problem better than Smalltalk. I don't know if there will be any consensus on that, given that programming can be a bit like trying to herd cats that are on fire. No further guesses from this corner, at least.

That's Grouse, not Sexpot

A shot in the daylight

I found out that Wine happily (well, mostly, anyhow) runs a game well known to Germans, called Moorhuhn. And that's not Moorhunn, as I found out by accident. Roughly translated from the German, Moorhuhn is a grouse. So Moorhuhn Jagd is "grouse shooting". Once you see the game, you'll think to yourself - this is simple. And it is. You have ninety seconds to blow away as many grouse as you can, without shooting down balloons, planes, and turtles that may be in the scene. However some other objects can be shot at, and also give you points too. I first came across the game when my mother told me about it. I've stuck it back onto the computer because it's less blood than Quake, and can actually be played by a six year old with no real damage to the psyche. There isn't just the one game either - there are a number of them, based on the same theme, with some slight twists. Moorhuhn 2 and 3 also appear to work under wine, and I got MoorHuhn 3 running on zoombuggy's machine too.

In fact, I decided I liked it enough to actually pay for it. Someone was offering the game for a really cheap price, so I purchased it. Now my only problem with the game is that the copy I paid for (and downloaded from the website) doesn't work in non-nag mode; instead, it pops up an annoying dialog box that happens when you haven't bought the software initially. Instead, and this is an irony, it works for zoombuggy on her machine under wine, with no nag screens. Ah well. Win some, lose some.

Especially in later versions (Moorhuhn 2/3) there are also little tricks you can use to extend either the time you can shoot for, or the number of points you get. And, best of all, it works under Wine too, for a fast enough machine. Go on... you know you want to...

10 December, 2007

La lettre est morte. Vive la lettre!

An Anachronism in today's times.

I wrote a letter today. A real true blue dinky die letter, and (with large numbers of modifications to suit a blog entry) it went a bit like this:


You are officially holding an anachronism in your hands; a throwback to the past when email, blogs, and Youtube hadn't been quite invented yet; Life, The Universe, and Everything hadn't been written, and we still thought for ourselves, or tried to anyhow. These days, we're more likely to ask if someone will be able to take a shot of their cat with their cellphone camera so we can display it on our LCD monitor as a backdrop, while we listen to the latest album from ColdPlay that we paid $1.99 per tune for and downloaded to our iPod. These days, Letters To the Editor are more likely to be emails, instead of pieces of paper.

There's the inevitable torrent of spam pouring into our ISP's mailboxes trying to sell you any NUMBER of things; while most of them will be deleted by the ISP, even they can't catch all of them. Then there are phone calls across the world through your computer for practically free, or very reasonable rates at least.

Send me a letter!

There's no reason for letters, when "stuff" is so much quicker, and we've become so used to response times of less than ten minutes (maybe an hour if we're busy and can't catch up) that letters have simply been left in the dust. That is, until the electricity goes out. Once that happens, none of the other stuff will work, especially if the phone network's gone down too. Then, only a good old-fashioned letter, sent by a friendly postal representative, will do.

Barring fires (and the occasional maraudering rubbish bin), letters have a longer life than some data CDs do, certainly longer than files on floppies, and eternally longer (and more durable) than most people's memories end up being. We haven't managed to duplicate these advantages of letters, even though we've come up with a far faster way of getting information from place A to place B on a certain mudball (the third one from the sun, I think).

Going Postal

Terry Pratchett wrote about letters having a spirit in his book "Going Postal". Get enough of them together in one place, and you have a critical mass. It's a comedy with a bit of a look at the more serious sides of life. Murder. Hanging. An angel. A new life. A new job, restoring the Ankh Morpork Postal Service, which has become moribund, useless, and frankly totally outdated and unused. The building, last used twenty years before, is looked after by one rather old codger with a breastplate made of flannelete, goose grease and hot bread pudding that's become tougher than kevlar, and one young pin fancier with less brains than the average rabbit, and that's after the "Wow, two moons!" moment.

Moist von Lipwig (ex-murderer, con artist, and all-around shyster) has gained a chance to reform his character, by reforming the Postal Service. He thinks it's all for nothing, but the letters have other ideas. There are hundreds of thousands of them in the building, including some that nobody ever wrote, and they must be sent. And so it is - he restores the Post Office, posts letters, and incidentally, manages to take charge of the very organisation that put the Post Office out of business to begin with. No mean feat, when the previous owner of that organisation (who refused his angel, by the way, and is now dead) fought VERY hard to have Moist killed, disposed of, and plain neutralised. But, the letters must be sent.

And so this letter will be sent, (and blogged) with many Christmas wishes to you. You can see a copy on my blogsite (you're reading it now, actually), but don't worry, I won't turn it into an mp3, to charge $1.99. Besides which, it's only my $0.02 worth, so I'd be making a horrible profit.

I wanted to make this letter personal, but it doesn't have that feel to me - I've only worked over three separate versions, one of which will appear as a blog entry online. This one alone survives in paper and handwriting form, just like the good old days when spam was probably edible, the web was pretty if it had dew on it in the morning, and people still thought for themselves.

Or tried to, anyhow.