Category Archives: Uncategorized

Remembering Nancy Haley

When I was on the Board of Directors for the Prairie Star District of the UUA, one of my favorite co-directors was Rev. Nancy Haley. She was always lively, thoughtful and thought-provoking. When we got mired in budget debates and fears about funding, she would dare us to dream big: that if our services were valued, they would find funding. And she was right. She would tell me about her son, a fellow geek who worked on the crowd animation software for Lord of the Rings. Through these conversations it became clear that she had her own inner geek, which was revealed when she did a worship service in which she had everyone make a Möbius strip.

She died suddenly and all too young; though she had grandchildren, last I saw her she had energy to last for great grandchildren.

Obituary

In 10 years, Real Programmers will use functional languages

Back when I started programming (on an Apple ][e, to help date things), there were two kinds of programmers. Real Programmers talked assembly language. Other programmers weren’t real, because they didn’t need to know the inner workings of their computers, and therefore didn’t really understand computers. More important from a pragmatic standpoint, Real Programmers could get the computers to do anything that was physically possible with the hardware– and the programs ran 10x faster.

Over the next decade or so, as compilers got better and computer hardware became tuned toward compiled code (rather than assembly language), C programmers were allowed to join the Real Programmer club. These days, Real Programmer usually implies C or C++. And now that even lowly Javascript runs within spitting distance of C, the distinction is nearly 100% machismo and 0% practical considerations. (Down from about 50%/50% in the early days and 80%/20% in the C days.)

But there’s still a practical reason for hiring a Real Programmer. Modern languages insulate you from having to think like a computer. That’s good, because 99% of the time you don’t want to think like the computer– you want to think like the users. But that other 1% of the time, if you can’t think like a computer, you’re going to run into major trouble. Assembly and C are weeder languages– it’s easy to weed out the good programmers from the bad ones. Java, C#, and the other modern languages make it really hard.

What’s worse, the language features in C that have gone away (manual memory management, for example) are now really, really bad ideas on modern multi-core, networked computer architectures.

Enter functional languages. They’ve been around since the 1960s, and have mostly been limited to the artificial intelligence community. They’re also well suited to failsafe, networked computing applications. (Google repopularized them with the Map-Reduce programming style it uses internally.) The basic idea is that you design using mathematical functions, rather than machine operations. The practical difference being that in traditional languages you modify variables, whereas in functional languages you apply functions to constants to obtain new constants. Because you avoid variables, you avoid all sorts of difficult problems where multiple processors are trying to edit the same thing at the same time. It also means that the computer has incredible flexibility in being able to cache partial results, retry calculations, split up the code between multiple processors, and otherwise optimize or handle hardware failure.

Functional programming isn’t hard if you’re mathematically inclined. If recursion doesn’t throw you for a loop, it can be just as easy as traditional programming. But it’s hard enough to separate the Real Programmers from the code monkeys. And its advantages are compelling enough for programmers to switch to functional models. The main thing keeping functional programmers from being considered Real Programmers by the C/C++ crowd is the cultural divide. Real Programmers take pride in knowing exactly where their ones and zeroes are. (Except they don’t anymore, thanks to virtual memory, three or more levels of cache, and processors that rewrite their code on the fly.) Functional programmers pride themselves on keeping their code in the mathematical realm, far from any real processors. But as it becomes more clear that the “hard core” programming problems are best solved by the programmer writing specifications which enable the computer to use all its fancy optimization tricks, we’ll see more and more Real Programmers switch to functional programming.

As what may be an opening salvo, the Go language was designed in part by some of the people who invented C, and is named after one of its functional features.

Gah! Java has no modulo operator!

Amazing that I’ve been programming in Java for about 15 years, and I hadn’t run into this before. Tells you just how insidious this could be. Java’s ‘%’ operator acts like a modulo operator most of the time, but it’s a remainder operator. Your formula may work just fine in C, Python, Perl, Excel, and everywhere else— until you hit a negative number.

The difference is that the range of modulo-n is 0..(n-1) for positive n, whereas the range of Java’s quasi-modulo is -(n-1)…(n-1). So x%3 in Java goes from -2 to 2, whereas everywhere else it goes from 0 to 2. If you get a negative result, you need to add 3 to get the right answer.

This comes up because I’m trying to find the quarter that a month is in. Quarters can be defined as starting in any month (e.g. the fiscal year for my church starts in July, so Q1 is July, August, and September.) But since months are a cycle of 12 (a modulo-12 number system), there are only three kinds of quarter systems: January starts a quarter, February starts a quarter, and March starts a quarter. Call them 0, 1, and 2, and call the months 0-11 (the way Java painfully does), and you can find the number of months since the start of the quarter as (month-quarterOffset)%3. As long as you’re not using Java.

The end of a rant?

I’ve had this rant for a few years now, and I repeat it every time I need to reboot my computer or phone for a system update. Why, in this day and age, should I need to reboot for a system update? The updates should just happen automatically in the background (with my permission, of course) without disrupting my work. The technology to do this has existed for decades. It’s a lot of work to get this to work seamlessly for legacy PC programs, but smart phones run apps in a more controlled environment where this sort of thing wouldn’t be difficult.

Now RIM, maker of BlackBerry smart phones, has purchased QNX, maker of highly robust real-time operating systems. Since 1980, QNX is what you used if your computer happened to be running a nuclear power plant, medical device, car, or anything else that must not fail. System updates don’t even slow it down.

The trick is that QNX is a microkernel operating system. The kernel (the part of the OS that is always running) is tiny. Traditional kernels contain all the code for handling the video display, the hard disk, the keyboard and mouse, and various other services that user-visible programs use. A microkernel is more like a traffic cop, handling messages to and from the programs that provide those services. Need to update your video driver? A new video driver program gets installed, and takes over from the old one. No reboot required. The only thing that requires a reboot is a change to the microkernel itself. And because the microkernel is so small and simple, there’s not much room for bugs to hide. And QNX has had 30 years to shake the bugs out. If RIM decides to go with a no-reboot-ever policy for system updates, they could do it.

Question for Latin lovers

In Latin, are spoken numbers constructed in the same style as Roman numerals? For example, in English, 1999 is spoken as “one thousand nine hundred and ninety-nine,” which matches the Arabic numeral construction. In Roman numerals you would write MIM. (Actually, in ancient Rome, you would have written MCMXCVIIII). So would the words in Latin be something like “thousand plus thousand minus one”?

This is why I love my church

Where else are people this creative about doing good?

Easter Canned Goods Hunt!

Instead of the traditional Easter egg hunt, we are holding a canned goods hunt! All cans of food found by the children will be donated to Joyce Food Shelf. You can help by bringing a can of food (or two!) to the Easter service on Sunday, April 4th and hiding it somewhere in the social hall or the chalice room before you go to the sanctuary for either service. You will be helping to create a fun activity for our children and providing a service ministry at the same time!

(From email to parents.)