Q10

I discovered a little gem the other day, a program called Q10. It is a wonderful little word processor, designed for writing and nothing else; it completely blacks out your entire screen and presents you with nothing but… writing. It even has little typewriter sounds to make it feel like you’re… writing.

It inspires me to create something. But what? Endless possibilities lie in front of me, a million ideas fluttering in the wind, ready to be grabbed and put into a literary masterpiece.

Unfortunately, problems loom ahead. The words do fine on their own, but the ideas that come to me seem to be rather a tangled mess of intertwining jumble. Take this example, the first two paragraphs of my first literary masterpiece: :)

The rain splashed down onto the platform from a dark and brooding sky. It was the kind of rain that falls with the intention of once and for all proving to people rushing to get home from a full day in the office, that the day can, in fact, get worse; and what funnier way of doing so than by soaking them completely wet while waiting for a train? The rain splashed loudly and happily onto the poor, hurrying persons being unfortunate enough, on this rainy Wednesday in November, to take the 6:05pm from Cheltenham Station; a train that was about 30 minutes late.

The reason that the 6:05pm was about 30 minutes late had, unfortunately, nothing to do with British Rail. It was largely because of a heated argument in passenger car number four, between a Mr. Nixby and a very unfortunate professor of high-energy particle physics.

I can’t wait to read the rest. The question is… where do you go from here? :)

The Web – a Flattening of Spaces

The Internet is one of the most amazing creations of the latter part of the 20th Century. Never before have so many been so connected; and it has never been easier to share and distribute information. For it shares a property with what some say about the Spirit world: There are no distances.

The whole Internet is a 32-bit gigantic address space that is immediately addressable; there is no need for complex delivery, local routers that take time, overnight transports (FidoNet comes to mind) – everything happens instantly. The time it takes to connect to a newspaper in Singapore, or the government office two miles away, is insignificant.

There are four billion unique addresses, all of them spread out like a flat surface in front of us, each node immediately accessable.

Of course, this means that everyone can also reach you, which is why we have so much spam.

It also means that there are few filters; filters in the form of editors, agents or journalists, whose job it is to filter through that torrent of data streaming in, and disseminating it, sorting away the irrelevant and providing quality. Nowhere is this more prevalent than in the blogsphere – so little critical thinking, so little original content, and so many mindless parrots echoing what everyone else said.

The quantity has increased a hundredfold, but the quality suffers.

Maybe there will come a day when we want to shut off all that noise, and employ people for us to sift through everything so we don’t need to process it. Right now, everybody reads everything, and as a result, nobody really knows anything.

Quality or quantity? What’s your choice?

Threading is Bad

Threading, as a software method, is bad.

The idea is good in itself: Make the program execution split up in several threads, which all run independently; creating an illusion that the program is doing several things simultaneously – and, if you have multiple cores, processors or hyperthreading, the program actually does several things at once.

It is a wonderful way to scale – letting ten users work with the same program, or hundred users, is all a matter of how many threads you create.

But from experience, we’ve realized that threading is very hard to pull off without glitches. Why?

  • It has proven very difficult to isolate threads from each other: They all access the same data, so you need data isolation through locks. But sometimes it’s hard to predict – especially in a GUI environment – which data that require locks or not. We’ve discovered instances where deeply embedded components were not “thread-safe” but actually used the same data source.
  • When threads collide, they do so unpredictably, and can be a nightmare to find. A program can run 10.000 queries without problem, and query 10.001 will crash the whole program.
  • It is very difficult to debug, and exponentially more so to observe thread collisions in a debugger.
  • Threading problems are more likely to occur in production systems that development systems.

.NET and Java do mitigate these problems somewhat, but still doesn’t solve the fundamental problem – that threaded programming is hard, error-prone, and can lead to very serious failure in production environments.

Erlang, the language developed by Ericsson, solves this in a wonderfully simplistic way. The main difference between a process and a thread in a conventional system is that threads share global data between them, whereas processes all reside in different address spaces and thus share no global data. Erlang doesn’t have any global data, and thus, the distinction disappears. As they say,

“If you think Java is stable, Erlang is rock steady.”

So, is there a way to mitigate this situation? There just might be.

What if there was a way to split the process into separate “services” that share no data between them? What if it was possible to create a message-based system of requests and responses, where the system itself would be able to create services as needed? And if the only way to communicate between these services would be through some kind of message system which is guaranteed to be stable? (WM_COPYDATA comes to mind.)

One might argue that copying data back and forth in the system is slower, more memory-consuming, and less efficient. But if we are indeed approaching a paradigm shift in programming, where the limits of a single CPU has been reached, it only makes sense to adopt a different methodology to work in a multi-CPU environment. More threads, more concurrency, more CPU’s running more threads simultaneously – then the problem of increasing speed can simply be dealt with by, basically, adding more CPU’s. Instead of tuning each thread at the expense of computational stability, you tune the available services and the overall flow of the system, which is one of the cornerstones in highly parallel environments. (Think of a brain.)

Of course it would pay off to fine-tune individual components/threads/services as well; the advantage of the service-based setup is that it would be remarkably easy to extract one service and test it, simulating a virtual testing environment around it.

Such a system might very well be implemented in Delphi, in a similar way as Erlang, by building services that run as threads and operate on Windows message queues. And since, ideally, no data would be shared between them, it would make no difference whether the individual components were in-process or out-of-process. Building on the Serialization module I built earlier, this might be quite easy to accomplish.

Likely candidates would be, for instance, our internal web server than I’ve never been able to make as stable as I want it.

First Light

Operation Enduring Residence is underway.

That is the fancy code-name for the move to my new apartment: A little three-room apartment not far from where I live now, but hopefully much, much quieter. It’s located in a rather rural part, and a friendly neighbor told me yesterday that it’s not unlikely to see sheep that have broken out from the pasture running around among the houses.

So, yesterday – even though no furniture has been moved yet – Phase 1 commenced and I brought some food, my computer and a couple of DVD’s, and a mattress. Phase 2 will initiate on Friday, when I take a day off from work and prepare lots of stuff; Phase 3 occurs on Saturday when we move everything, and Phase 4 will conclude with final handoff of the old apartment on Sunday.

There’s no fun in doing anything if you can’t coordinate it like a military operation. :)

Besides, I think I shall call my new apartment “Newhaven”. It seems fitting.

Random Clippings

… while intended to help this particular parasitic segment of the corporate world to behaviorally model the psychological predispositions of software developers at their work in an unrealistically simple way, it has instead turned into a system of limitations that developers have begun to impose upon themselves to the detriment of the advancement of software development practice and industry …

I hope I don’t write like this.