Categories
Programming

Better Future With Better Tools

I was lying on the grass in Holyrood Park this evening, having returned to my hobby of finding new ways to fall off mountain bikes (by cycling backwards, or doing no-handed trackstands). The first thing I noticed was that I usually think of the sky as “that thing above the horizon”. That’s very two dimensional of me. When you’re lying on your back, the sky becomes this big circle all around you. I then spent a while trying to change my point of view from “I’m lying on the ground and the sky is above me” to something more like “I’m stuck to the earth by gravity and ‘up’ and ‘down’ are just convenient notation rather than being the whole truth”. And then I got onto software engineering ..

Categories
Programming

Squeaking towards ICFP 2003

I am waiting for the ICFP programming contest to start. I’ve even managed to remember that we’re currently in BST, and the contest starts at 0:00 GMT. What posessed them to start a contest at this time? This is taking geek obsession with zero-based numbering schemes to new levels of stupidity.

Anyhow, I am using this contest to test Squeak “in the real world”. I’ve done lots of small-scale programming using Squeak recently, but now I want to see if it stands up to a 24 hour coding frenzy (I’m only entering the lighting division). So, first and foremost this is a Squeak coding exercise, and if I eventually submit an entry that’ll be a bonus. I wonder if they’d given bonus points if I managed to submit working entries in five different languages?

I’ve been playing around with recording my desktop with vncrec. I briefly thought about recording the whole of my ICFP effort so I could review it later. It’s really trippy watching yourself programming. You notice how inefficient current GUI’s are. I’ve just watched a recording of myself trying to click a small button, and it takes several attempts to get just the right position. The same problem occurs when positioning the insertion point before typing. No wonder Apple’s magically zooming application launcher is such a good thing for mouse users, and no wonder that I prefer to keep my hands on the keyboard. I don’t like the way that keyboard shortcuts in Squeak change their meaning depending on which window you’ve got highlighted. I’d like alt-B to always bring up a browser, regardless of where the pointer is.

On a seperate topic, I intend to later add a ‘autocomplete selector’ feature to the Inspector window. Since smalltalk is dynamically typed, you don’t really get the same sort of autocompletion which is available in IntelliJ or Visual Assist. However, if you’re entering code in an Inspector window, you do know what type ‘self’ is, so you can do better than the command-Q shortcut which just autocompletes using every single selector in the world. Most of the time, I’m typing “self foo” into Inspector windows, so it’ll be useful for me.

Categories
Programming

It’s so simple

“If we spoke a different language, we would perceive a somewhat different world”. Quotations on Simplicity in Software Design.

“There is nothing permanent except change”.

Sigh.

Categories
Programming

Update Debt

A random “design pattern” which just popped into my head:

Imagine you have some large data structure which is expensive to update. Maybe it’s a list of integers and you want to clamp each element to be between 0 and 100. Normally, you’d go through each element, perform the check and update it if required.

Instead, I suggest keeping the original list and creating a seperate log of the ‘modifications’ which have been made to it. So now you have the original list and a note saying “by the way, when you read an element you also have to clamp it to the range 0-100”. Now you’ve made the update cheap, but accessing the data is more costly.

However, if your program is otherwise idle later on, it can come back and coalesce everything back down.

So you’re basically saving time in your “change it” code, paying it back a little at a time in the “access it” code, and you’ve got the option to pay off the debt entirely when you’ve got a bit of idle time spare.

Whether this is useful or not depends on the frequency and cost of updates and accesses. I’m noting it here as another potential “tool in the box” for algorithmic optimization. It probably lives next to memoization and similar such techniques.

Categories
Programming

Grr, Open Source

I play in a rock band, and as a consequence I’ve been spending a lot of time trying out audio software under linux. Usually when I’m trying out programs I have quite a high tolerance for bugs, clunkiness and bad designs, but when I’m using computers to record music I want to get on with the music and forget about the computers.

Without being disrepectful to the efforts of the Linux Audio Developers, currently linux ain’t a great place to be for audio. It’s getting a lot better with ALSA and Jack. But there’s no way I would recommend linux audio to anyone other than a hardcore techy.

So, should I install Windows and do audio there? I’d rather not give Microsoft any money. Maybe I should buy a Mac? I’m sure the grass would be greener over there. Certainly, the idea of paying some relatively small amount of money to get some better quality software sounds attractive. Gosh, that’s me .. a devout linux user .. wishing for a bit of commercial software.

There’s nothing special about these other operating systems in terms of the technical features they offer. The difference is the presence of commercial software companies who produce decent quality applications. You don’t get much of that under linux. These companies spend a while checking out user requirements, writing the code (including all the boring bits) and only shipping when it’s good enough to capture a reasonable share of the market. The end result is never going to be perfect bug-free software, but it’s pretty good.

I’d love there to be a top-class open source audio package for linux. But I don’t see how one is going to appear. If I were to write such an open source package, I’d have to do it in the evening after I come home from work. After all, I need to work during the day in order to buy food, pay the bills and live within our current economic system.

So, there’s the rub. If you want to get a team of focused developers working on an application, you need to pay them so that the project can be their “day job” and they can pay the bills. The only way you can pay them is if you can make money by selling the results of their efforts. Commercial software makes sense.

There’s certainly lots of people out there who expend huge effort developing open source software for apparently very little reward (the guy writing Ardour comes to mind). I would like to be able to do this kind of stuff without burning the candle at both ends. I work enough (paid) hours programming for my employer, and that leaves me disinclined to spend the remaining waking hours coding.

Also, since the volunteer brigade consists almost entirely of geeks, they have great success at certain types of application, such as web servers and compilers. Geeks like playing with new technology. They like doing the cool stuff, and consequently they tend to leave the boring bits of applications incomplete. Witness the number of projects with some small bit of “cool technology” at the core, but with atrocious GUIs. Maybe audio software is more left-brain touchy-feely and doesn’t win so big with the volunteers.

Apart from volunteers, there are other ways in which open source software gets built. Some open source software comes out of academic research projects, funded by government or industry. Some software starts life as an internal company tool which gets jettisoned, such as the Objective C support in gcc. A small amount of software is specifically commisioned by someone who pays a programmer to fulfil their requirements. I’ve done this kind of work before, but there’s not very much call for it.

Economies of scale make “commisioning” unsuitable as a method of seeing that good linux audio software get written. When a commercial company wants to build a new application, it takes on a certain amount of risk (the cost of development) which it hopes to recover through many sales of the product. The cost of the product is ultimately shared across many people. If someone were to commision an open source audio project they would singly bear the cost of development, which makes it prohibitively expensive.

I appreciate the technical advantages of open source software. I have often took advantage of the opportunities for learning, extending and fixing open source program which I couldn’t have done if I were using closed commercial software. And, I’ve volunteered lots of time to work on such projects. But I don’t see how it’s possible to truely walk the free-software walk when we live in a capitalist economy. RMS can believe that “reward is often not a motivator” if he wants, but peer recognition isn’t going to pay the bills.

Actually, I’ll postulate a thought experiment in which we already live in the RMS world, where all software was free. One day, someone comes up with this radical new notion of “proprietry software”. The promise of these crazy guys is that, if you’re prepared to loose some of your software freedoms and pay them a reasonable amount of money for results, they’ll be able to get some programmers together to concentrate full-time on the software, rather than working in a call-center or whatever they’re currently doing. What’s more, they’ll be able to get HCI experts to help design the GUI, and good authors to write the documentation.

So, my original question was “how do you write better applications?”. Open source may have many eyes making bugs shallow, but commercial software has fulltime eyes working on the program every day.