Archive for December, 2007

Sweeney Todd

Sweeney Todd actually works better as a movie than on the stage, at least when Johnny Depp is on the screen. The music overcomes the staginess and melodrama of the story. Closeups make Sweeney Todd more tortured and less bombastic. On the other hand, I think that Angela Lansbury (who I’ve only seen in video) did a better job on the Mrs. Lovett role than Helena Bonham Carter.

It’s a pity Tim Burton couldn’t keep the chorus in the movie, though, as that is my favorite song.


Create Inevitability

I read an interesting article about Montenegro, a country which I know nothing about. Montenegro only recently became an independent country, after an election in 2006. (This was not the first time Montenegro was independent, but until the election it was joined with the much larger country of Serbia). The point of the article was that approach used by the supporters of Montenegrin independence. Polls in the early 2000s showed only weak support for independence. The EU decided, seemingly arbitrarily, that independence would only occur if 55% of the population voted for it.

The supporters apparently reached their goal by acting as though it was inevitable. Years before the election they started acting as though Montenegro was a separate country, declaring their own economic policy, negotiating agreements with other countries, and so forth. They created a flag and picked an official anthem. The effect of these actions was to make independence seem natural. Thus by the time of the actual vote, voting for independence seemed natural. The vote was still close—they barely got the 55% they needed—but it did pass.

More interestingly, this is not the first time this has happened in Montenegro. Montenegro started out as, essentially, four small districts more or less in the middle of the current country, hundreds of years ago. For whatever reason, those districts decided to create the trappings of a government. They proceeded to make treaties with other countries, and started to aggregate the surrounding districts. Eventually, over a couple of hundred years, they grew to the country’s current size. By acting as a real country, they were able to become a real country. This was mostly within the Ottoman Empire, although they managed to negotiate some independence within the empire. Later they became fully independent, in 1878, before a series of political shifts eventually left them as part of Yugoslavia and then Serbia.

I’m sure I have some of the details wrong. But the idea I find interesting is this notion of acting as though what you want to happen will inevitably happen. This is quite different from going around arguing that it should happen. It is an argument by action; people will tend to go along with you just because it’s easier. Your goal will seem increasingly natural, and will eventually be achieved. Of course, you can’t ignore what other people are telling you, and indeed you must adapt it. Still, you assume that your goals will win out in the end.

This will work best when you care much more about what you want than other people care about stopping you. In general that is of course always a good position in which to get things done. But I like the approach. It seems much gentler than constant argument, while still achieving your goals.

Comments (3)


I’ve written code in a number of different languages. The ones which I would say that I was or still am fluent in, in the sense of having written significant programs in them, are, approximately in order: Basic, FORTRAN, Cobol, Forth, APL, PL/1, Pascal, T, C, Common Lisp, Id, Scheme, sh, Tcl, C++. I’ve dabbled in other popular languages of today, like Perl, Python, and Java, but I’ve never written significant programs in them. I’ve ommitted various assembler languages from the list.

Of these languages, one stands out for ease of programming: Scheme (and T, which is basically the same language with additional bells and whistles). In Scheme, I can write programs the way I think about them. There is no complicated mapping from my ideas into the ideas expressible in the language. There are no syntax errors or concerns about data representation. The language is extremely powerful, thanks to the use of lexical closures and call-with-current-continuation.

Unfortunately, even with the very clever compilation techniques which have been developed over the years, code written in Scheme does not run as fast as code written in C/C++. So I don’t use it.

Some people seem to think that it is hard to program in Scheme or in Lisp like languages in general. I’ve never understood this position. I think that anybody comfortable with recursion, which I hope includes all professional programmers, can program in Scheme. But perhaps some programmers do have a non-Scheme way of thinking. I wonder what that would be like.


Programming in C/C++

Why do people still write in C/C++? As many people have said over the years, C and C++ are sharp knives. Pointers and casts are the sharpest of the knives, and many people have run into difficult bugs in those areas. Java generally doesn’t have those problems. Why doesn’t everybody program in Java?

The obvious reason is that C/C++ code runs faster than Java code. Arguably this is less true for long running programs where the Java JIT can adjust and optimize the hot code. However, despite that argument, C and C++ still seem to be faster in practice. At the current state of the art, it may be because C/C++ programs can be hand tuned to run faster than Java programs can. If Java ever becomes consistently faster than C/C++, I imagine that many people will switch.

A less obvious reason is that it is possible to avoid the problems with C/C++ through disciplined coding. While I certainly still write buggy code, I almost never write bugs related to pointers or casts. And since pointers correspond well to the underlying processor instruction set, using them yields faster code without any special work from the compiler or the JIT.

Returning to the theme of the multi-core world, there this rule may be reversed. The open question is whether it is possible to use a disciplined approach to writing multi-core programs in C/C++. It seems clear that Java’s threading support is ahead of C/C++ in terms of ease of use and ease of writing correct programs. On the other hand, it is much less clear whether JIT techniques can be sufficiently powerful to match C/C++, if it becomes reasonably possible to write correct C/C++ parallel code.

An example of a JIT technique for parallel code is transactional memory. I expect that transactional memory will never work in the C/C++ world; it simply costs too much. It will always be possible to beat it through careful coding, and people who aren’t willing to do careful coding won’t be writing C/C++ parallel code in the first place. The future of transactional memory, if it has a future, is clearly in Java and other JIT languages. I’m surprised that the various people pushing transactional memory haven’t realized that.

Comments (2)

Physical Laws

Where do physical laws come from? Of course we can not know. We don’t even know if the physical laws are the same everywhere in the universe–we assume they are, but there is no way to be sure.

In the absence of knowledge, we have to give up, or guess. My current favorite guess is the landscape theory. In this theory, there are a vast number of universes, of which ours is just one. Each universe can have its own set of physical laws. Our universe is not special. The fact that we exist to observe it proves merely that the physical laws in our universe suffice to support our form of life (the weak anthropic principle).

This theory appeals to me because it satisfies the Principle of Mediocrity: we are not special. If we were special, we would have to understand how and why. Since we don’t understand, I think it makes more sense to assume that we aren’t special.

Comments (3)

« Previous entries Next Page » Next Page »