[ Content | Sidebar ]

playoffs, round two

October 19th, 2004

Imagine: last Friday, I thought the playoffs were getting boring. 2-0 leads in both series, no reason to think that either underdog had much of a chance. When driving to the restaurant on Saturday, the Red Sox had taken a lead, so I was starting to perk up, but by the time the meal was over, they’d given up 13 runs, with more to come. (The dinner was at the excellent Shiki Sushi, which we went to for the first time. I’m not sure the sushi is quite as good as that at Sushitomi, but that’s a very high standard, and the non-sushi parts of the menu are much more varied. With monthly specials that, this month, included three matsutake mushroom specials and a monkfish liver special. Very friendly staff, nice ambience. It won’t replace Sushitomi as our Japanese restaurant of choice, but if they were both equally far away from our house, we’d probably go to both equally often.)

And then Sunday looked like more of the same – the Red Sox took a lead, the Yankees took the lead back, and that was that. Except it wasn’t that – the Red Sox tied it against Rivera in the ninth, and won in the twelfth. But I still wasn’t convinced; at work on Monday, I saw (well, “saw” – I just was watching icons on a Java applet) the Red Sox take the lead, I saw the Red Sox lose the lead, I thought it was probably over. But then, just as I was leaving work, the Red Sox tied it up; by this time, I was starting to learn my lesson, and was looking forward to listening to them win on my ride home.

The game did not, however, finish on my ride home, or even two hours after my ride home. I won’t go through the blow-by-blow, except to say that Tim Wakefield is one of my favorite Red Sox. The thing is, though, that apparently wasn’t even the best game played yesterday – by all accounts, the Astros / Cardinals game, which basically started and finished while the Red Sox and Yankees were in extra innings, was an absolute classic. Great pitching, of course, great defense (I had no idea Carlos Beltran was such a good fielder), and as dramatic a finish as one could hope for.

And, as I type this, the Red Sox just forced game 7. I never ever expected Curt Shilling to appear again in the postseason; and what an appearance! Nice to see the umps get calls right, too – I actually kind of expected them to get the home run call right, but I’m really impressed that they got the other play right, where Alex Rodriguez knocked the ball out of Arroyo’s hand. I can’t wait until tomorrow…

Side note: I’m really glad baseball switched to an unbalanced schedule last year. The AL West ended in as exciting a manner as possible, with Texas, Anaheim, and Oakland slugging it out (though I would have preferred a different outcome, of course), and, as I learned on the radio today, the Red Sox and Yankees’ game today was their 51st meeting in the last two years. (Splitting the previous fifty meetings equally.) That’s the way it should be.

mplayer

October 15th, 2004

One of the reasons I upgraded my computer a month or two ago was to make it a little easier to easily install new software. Like, for example, mplayer. This is a video player for Linux, and it’s great! I actually learned about it first at work: I needed to look at some movies, and one of my coworkers recommended it to me. I didn’t feel like compiling it myself for Red Hat 8, so I found a spare Windows machine, assuming that one of the standard video players there would handle the format that I needed. Neither Windows Media Player nor the Quicktime player could, though; I found a free player that could play some of them, but not all of them.

But mplayer can. Well, mostly – I sometimes run into a bug (which one can work around) involving, as far as I can tell, movie files that are more than a few gigabytes in size. But that’s not a big deal, and I’m really happy with it on my home computer: I can finally watch Quicktime movies again. Back when video game web sites were new, they posted movies encoded with Quicktime 2; that was an open format, so there were Linux players for it. Quicktime 3, however, used the proprietary Sorenson codec, so for years I couldn’t download videos of games in action. But Quicktime 4 uses MPEG 4, and mplayer handles it just fine. So I can, say, watch a video review of Donkey Konga and decide that, as much as I want to support video games with conga drum controllers, I really don’t think I’d enjoy it too much. (The list of songs really doesn’t appeal to me.) Or if I could only look at screenshots of Okami, I might be curious about the game, but it looks amazing in videos. (Hmm: I wonder if the “okami = wolf / large god” wordplay informs Princess Mononoke as well?)

pikmin 2

October 12th, 2004

I intend to post thoughts here on video games that I finish playing. These aren’t intended to be reviews or explanations of the game, and in particular may not make much sense to readers who haven’t played other games discussed in them.

Today’s game is Pikmin 2. A sequel to Pikmin, obviously, which is a sort of real-time-strategy game with puzzle and adventure elements. RTS is a genre that I have played almost not at all, largely because it’s an almost exclusively computer-only genre that didn’t appear until I switched over to console video games. Which is a shame, if for no other reason than that it’s a hole in my education. And I suspect that I would enjoy the genre – I like non-real-time strategy games, after all. Then again, I like to spend time thinking about what I’m doing during strategy games, so maybe I would find RTS’s more frustrating than enjoyable. Also, I can’t use a mouse on a computer (because it kills my hands), and I suspect the genre wouldn’t work well with a touchpad. If I didn’t have a laptop at home, I would consider switching over to a trackball; that would probably work well as an RTS input device, and other people I know with RSI problems say that trackballs work okay.

Anyways, back to the game. It’s very similar to Pikmin, with only minor gameplay tweaks. The main changes are:

  • There’s no 30-day time limit.
  • There are two new colors of pikmin: white and purple. (Along with another kind of pikmin-like creature, the confused bulborb, that you sometimes control in caves.)
  • Much of your time is spent in the aforementioned caves: there’s about as much to do above ground as in the previous game (maybe a bit less to do, actually), but the gameplay is extended by storing lots of the treasure in caves.
  • There are two characters to control instead of one.

There are some minor changes, too: yellow pikmin no longer carry bombs but are, instead, resistant to electricity; the treasures held by boss monsters at the bottoms of caves usually provide slight upgrades to your leaders; there are a couple of juices you can use to either power up your pikmin or freeze monsters.

So: is it an improvement? Getting rid of the 30-day limit is, on the whole, an improvement, but only a slight one. When playing through the first game, I made it about a third of the way through, decided that I wasn’t making progress fast enough, and started over, knowing the game faster and not saving at the end of a day unless I’d made enough progress. So I had to play several days a couple of times, but on the whole it wasn’t particularly tedious.

The thing is, while getting rid of that resource limitation, they added a new resource limitation to this game. Lots of the game takes place in caves; while in a cave, you don’t get new pikmin (at least through normal mechanisms), so, assuming you don’t want to play through a cave more than once, you have to restart a floor if you’ve lost too many pikmin. And, to make matters worse, there’s no convenient mechanism to restart a floor (or to not save your progress when going down a floor if you’re not sure if you’ve lost too many pikmin): you have to exit the cave, be sure to select that you don’t want to save, then end the day, again being sure to select that you don’t want to save, and only then can you reload. Which is just tedious, and it’s silly for game designers to get stuff like this wrong: I don’t mind gameplay elements that require you to play them over and over – indeed, it would be a little unsatisfying if, say, boss battles weren’t hard enough to make you go through them more than once before succeeding – but if you’re going to do that, don’t design the user interface to make restartng gratuitously difficult.

Another gripe that I have about the caves is that they tilt the balance of the game more towards fighting than in the original. I’m not sure that this game has fewer treasures that require clever thinking before you can recover them, but it’s certainly the case that it has many more treasures that only require fighting to recover them. Along these lines, it’s a pity that using both your leaders isn’t required for more of the puzzles in the game; sometimes, it’s used well, but much of the time the second leader is irrelevant to the action. The extra flavors of pikmin are occasionally cleverly used in puzzles, but honestly it feels like they were added mostly because a sequel has to have something “new” about it. (And to provide another somewhat gratuitous resource limitation, since it’s much harder to get new purple and white pikmin than the other colors.)

Don’t get me wrong – it’s a solid game. There are too many bosses to fight, but usually I enjoyed the boss battles. Another little thing the game did well is to provide multiple satisfactory ending points: you can finish the main goal of the game after playing only about half of it, so if you want to stop there, you’ll still feel like you’ve accomplished something. It looks like, in fact, there are two goals after that, to find Louie again and to recover all the treasures (and discover all the monsters, if you wish). I say “looks like”, however, because I decided to play through the remainder of the game in a way as to leave Louie to the end; I have one and a half caves left, but unfortunately the cave I’m fighting through now is one that exists only to stretch out the length of gameplay. Which is, actually, fine with me – if I were on a limited income, I would appreciate mechanisms for stretching out the gameplay – but, as it is, I’m taking a break for now to play other games. (I might get back to this game; if so, though, I’ll probably exit the cave I’m in halfway through, and try to do the other cave with Louie at the bottom instead.) And Miranda likes it; she’s played through the first few days, though it gets a bit too tricky for her once she can’t avoid combat any more. The first game was solidly designed, enough so to easily support a sequel.

Minor infelicity: bud pikmin really are pointless – with normal gameplay, you’ll never create them after your first few days in the game. They’re not hurting anything, so it’s fine that they’re still there in the sequel, but they were a mistake, albeit a slight one.

mpeg: interlacing

October 9th, 2004

Here’s another fun (?) aspect of MPEG. As mentioned last post, TV (at least in the US) isn’t really 30 frames per second: it’s 60 half-frames per second, where half of the time it shows the odd-numbered lines and half of the time it shows the even-numbered lines. (This is called interlacing.) Since MPEG both wants to play on TVs and wants to be able to encode TV programs, it of course has methods for encoding interlaced content. There are two basic ways to do this: in one, called field pictures, each picture only includes half the data. In the other, called frame pictures, each picture includes complete data, but you can indicate that you want the two halves of the picture displayed at different times, and (if so) which half to display first. (Or you can indicate that you don’t want the two halves displayed at different times; a good TV will support this.) In my experience, frame pictures are used much more frequently than field pictures; I’m not sure why (and, for that matter, I also don’t know if my experience is representative).

But that’s not all there is to the story. Recall that movie content is 24 frames per second. So what’s the best way to play this on a TV? If you think of a TV as being 30 frames per second, then you should probably just display every fourth frame twice. But if you think of a TV as being 60 half-frames per second, then it gets more interesting: you want to divide 24 full frames into 60 half-frames. So, on average, you want to spread each full frame of the movie over 2.5 half-frames on your TV. Now, of course, you can’t actually do that, but maybe you can have the movie frames alternate between taking 3 half-frames and 2 half-frames.

And MPEG has a bit just to support this: repeat_first_frame. If this bit is set on a (full) frame, then the first half of the frame gets played twice. So frames are encoded like this:

  1. repeat_first_frame set, top_field_first set: display this movie frame as Top, Bottom, Top.
  2. repeat_first_frame not set, top_field_first not set: display this movie frame as Bottom, Top.
  3. repeat_first_frame set, top_field_first not set: display this movie frame as Bottom, Top, Bottom.
  4. repeat_first_frame not set, top_field_first set: display this movie frame as Top, Bottom.
  5. Start over.

This is known as 3-2 pulldown. DVD players and TVs will advertise themselves as having special circuitry to detect this case, so they can display it as smoothly as possible.

Of course, it’s still more complicated than this – you can control interlacing both via the progressive_frame bit (in one header) and via the progressive_sequence bit (in another header), and the latter changes the meanings of various other bits. Lots to learn about.

mpeg: frame rates

October 5th, 2004

I’ve been reading through the MPEG 2 standard recently, specifically the video parts. It’s pretty interesting, in a weird way; makes me want to go out and write an MPEG decoder, just to experience that particular sort of complexity, except that doing so would take years with no real reward at the end. I’m used to standards that are either much more straightforward to understand, or if they aren’t (C++), they’re complicated because they want to expand the realm of what’s theoretically possible, and doing that expansion into areas that aren’t well understood.

MPEG is different. MPEG just wants to be able to paint pixels on the screen, and have those pixels change over time. It is, of course, trivial to come up with a format that allows you to describe this. But you need the resulting files to be small enough to fit on disks using current manufacturing technology, or to be streamed over the air using currently available transmission technologies. You need them to be able to be decompressed quickly using current hardware (which can, admittedly, be custom-made for the purpose). You need them to play on current TV’s, not just current computer monitors. And you need them to be good at compressing certain specific kinds of content, like movies and TV shows. I am not used to formats in which all these challenges come together this way.

Take frame rate, for example. If I were designing a format, I’d just say “make it an integer, the number of frames per second”, and if pressed, my first reaction would be “computers usually use 32 bits these days, so let’s go with that”. But of course we don’t need movies that contain 4 billion frames per second, so I would admit that only 16 bits, or even a lowly byte would probably be adequate.

But, actually, MPEG uses (if I’m remembering correctly) 4 bits for this. They don’t do this by limiting the frame rate to 16 frames per second – instead, they only allow a few specific frame rates, so 0001 stands for a certain frame rate, 0010 for another, etc. MPEG cares about TV, so one of the allowed frame rates is 30 frames per second. Except that TV actually shows 60 half-frames per second (because of interlacing), so MPEG also allows 60 frames per second. And MPEG cares about encoding movies, which are at 24 frames per second, so that’s another value. And it’s a world-wide standard, while the 60 half-frames per second is an NTSC thing, so it allows 50 and 25 frames per second for PAL content.

But that’s not the whole story. In fact, TV isn’t 30 (or 60) frames per second – it’s 29.97, more or less. The story here is that TV used to be black and white, of course, so only brightness (“luminance” is the term used) was encoded. Then, to add color, they stole a little bit of bandwidth by (among other things, I think) squeezing the frame rate ever so slightly, to 29.97 (or 30,000 / 1001, I think) frames per second. (This also means that TVs expect much less color data than luminance data, which also leaves relics in the MPEG standard, but never mind that.) So MPEG can be at exactly 24, 30, or 60 frames per second, but it can also be at 23.97, 29.97, or 59.94 frames per second. But for 25 or 50 frames per second, only the exact values are allowed, because the historical reasons only apply to NTSC, not PAL.

(Side note: Manny! Good start to the playoffs.)

no playoffs

October 2nd, 2004

The A’s neglected to make the playoffs this year. They just had to win the series this weekend with the Angels; they’ve already lost the first two games.

I never seriously expected this to happen, though admittedly the A’s haven’t been overwhelming this year. Their bullpen started the season badly (I always expect Billy Beane to steal cheap bullpen help, but he didn’t manage that this off-season), and while it stabilized, it never was dominant, and had some noticeably failures at the end of the season. (Today, for example.) The offense has gotten surprisingly decent contributions from many people; it wasn’t stellar, but it was at least respectable, which was better than I’d expected.

The starting pitching was the big surprise this year. At the beginning of the season, Zito was awful and Harden was bad, but actually I wasn’t too surprised to hear that, and Hudson and Mulder were excellent, Redman was decent. And Zito and Harden picked it up nicely towards the second half of the season, especially Harden.

But Hudson was somewhat off towards the end of the season, and Mulder was downright awful. The A’s don’t admit it, but I have to assume Mulder was hurt. With that, their starting pitching was mediocre, and they didn’t have any real strengths (except maybe their defense), and it’s hard to make the playoffs that way.

Wait till next year, I guess. Probably several hitters will regress; Crosby and Chavez could both easily get better, though, and Harden and (maybe) Blanton could contribute to the starting rotation. Right now I’m not too optimistic that the A’s will get much better next year, but I don’t see why they should be much worse. And maybe Billy Beane will do something clever this off-season.

Go Red Sox, I guess. And maybe the Giants will make the playoffs and I can root for them, too.

osamu tezuka

September 29th, 2004

A few years ago, when I was starting to get seriously interested in comics, I read Dreamland Japan, by Frederick Schodt. One of its main points was that a huge advantage Japanese comics had over American comics was that Osamu Tezuka was Japanese. And I was willing to believe it – the guy had apparently written huge numbers of comics series, some less serious (Astro Boy, for example), some more serious (Phoenix, Adolf, for example), all excellent in their own way.

So I started reading all the Tezuka in print in English. At the time, that was only a couple of volumes of Black Jack and all five volumes of Adolf. So I read them. The thing is, I didn’t like Black Jack very much. I thought Adolf was pretty good, but for World War II-inspired comics, I’ll take Maus any day.

I was then pleased (and quite surprised) to see a volume of Phoenix appear in English. Finally, I thought, Tezuka’s masterpiece – now I’ll see what I was missing, right? Well, no – better than Black Jack, sure, but there are lots of books out there that I like a lot more. Maybe it will grow on me (and, to be fair, I’ve enjoyed the next couple of volumes more than the first), but either I’m missing something or he’s just not to my taste.

For whatever reason, though, I kept on looking for more Tezuka books. So when Astro Boy started appearing in English, I bought the first few volumes. And they’re great! It’s a series about a robot superhero, it’s a lot of fun to read. It’s wonderfully humane (hmm, is that why I like Zot so much? Or is that really a dominant characteristic of Zot?) and the story lines vary enough that I’ve read 12 volumes so far and have no desire to stop.

Like I said above, I was surprised to see Phoenix out in English. I know (and am very glad) Japanese culture is more and more popular in the US these days, but I still thought Phoenix was bit too fringy to appear in this country, since it didn’t seem to me to be the sort of thing that the youth of America would read. But I was really surprised to see Buddha come out in English: Phoenix had the advantage of being labeled as Tezuka’s masterpiece, and I would have thought that Buddha‘s topic would make it even less likely to appear in this country.

Buddha is amazing. I love the plot. I love the characters. (Many of which are, of course, canonical, but Tezuka added a lot, including, if memory serves me well, the entire first volume.) As with Astro Boy, it’s wonderfully humane. The drawings are great, including some of the most beautiful scenery that I’ve ever seen in a comic book (simultaneously emphasizing its epic scope and its meditative nature), the aspect-to-aspect transitions are used to great effect (lots of the examples in Understanding Comics are taken from Buddha).

Now is an excellent time to be alive.

broken watch

September 28th, 2004

I bought a new watch earlier this year. I liked my old watch, but it had some scratches on the face and was getting kind of chipped around the edges, so since I’d had it for most of a decade and the battery had died, I figured I might as well buy a new one instead of replacing the battery. I couldn’t find one I really liked, though I’m basically happy with the one I ended up buying. One thing which bugs me about it, though, is that it has a big second hand which normally doesn’t move: the second hand is for the stopwatch, while the non-stopwatch second hand is in a little dial at the bottom. (There are also little dials for the stopwatch minute and hour hands.) Why not use the big hands for the normal time and the little hands for the stopwatch?

That’s a minor quibble, though. What is prompting this post is that the watch broke in a strange way yesterday. It still works, except that the stopwatch second hand, when at rest, is pointing at about 58 seconds instead of straight up. Which just looks bad. Fortunately, there’s a solution to this that solves the problem from the first paragraph as well – now I just leave the stopwatch on all the time. Still, I was expecting the watch to be more solid than this – one reason why I bought it was that a couple of people at work volunteered the fact that they’d had Fossil watches for a while that had lasted well.

I wonder exactly what went wrong, too. I have to think that there’s got to be some simple fix for this if you know what you’re doing, but I’m too nervous / lazy / lacking in tools to open up the watch myself, and I don’t feel like either sending it off to the manufacturer or paying real money to deal with such a minor problem. When I have to replace the battery, though, I’ll see if I can get it fixed then. For that matter, maybe it will fix itself – there wasn’t any trigger that I’m aware of that caused it to go wrong. (More likely it will get worse, I suppose.) I just get a little frustrated when there are things that I feel I could understand that I don’t actually know the answer to.

Side note: the tv antenna is continuing to work well, at least on some channels; right now I’m watching NOVA in HD. Looks nice. Not perhaps as spectacular as I would have thought, given the HD propaganda one hears; part of the reason that I’m not so impressed, probably, is that I went from a 20″ tv to a 27″ tv, and of course SD looks better on a 20″ tv than a 27″ one.

piano needs maintenance

September 27th, 2004

My piano needs maintenance. It’s been a while since it’s gotten tuned, but it actually doesn’t sound too bad. But there’s one note that clicks when you play it, and sometimes the keys don’t always come all the way back up when you play them. That’s actually been happening for a while when the pedal is down, which is interfering with my grand plan to actually learn how to play some music written since 1750, but I could deal with it since mostly I play music written before then. But now it’s started to occasionally happen without the pedal down, which is really no good at all.

Unfortunately, I don’t know any good piano techs. I don’t want to go with the person who did the free tuning a month after I bought it, since he’s had two chances to fix the clicking note and hasn’t succeeded either time. And none of my local friends play the piano. So I guess I’ll have to pick somebody more or less at random, and cross my fingers.

I’m hoping that the issue of keys not coming all the way back up is something I can learn how to fix myself. (And I’m also hoping that the piano grows out of it – it’s actually a very nice piano, but that really is not good behavior.) I suspect it is – I took off the front of the piano (it’s an upright), and looked at what was happening, and I think that I probably just have to turn the right screw somewhere. Still, it would be nice to have somebody to watch while they’re fixing it, so I can learn what to do.

chain

September 26th, 2004

A recent post on the Samuel R. Delany mailing list mentioned that he has a piece in issue 11 of Chain, a magazine published out of Temple (judging from their address). The same issue also apparently has an article by a friend of mine from college, Stephen Burt, as well as one by Rachel Pollack, the author of the excellent Unquenchable Fire. So I guess I’ll have to give it a look! Anybody know anything about the magazine? The Delany is called Eden, Eden, Eden: Genesis ii, 4, to ii, 22; no idea if it’s fiction or not.

Another post on the list says that copies of Delany’s short film Orchid still exists; I can’t say I have high hopes for it, but being a Delany completist, I can’t wait to get a look…

nintendo ds

September 24th, 2004

Nintendo is introducing a new handheld in November, the Nintendo DS. It has two screens, the bottom one is touch-sensitive (a stylus is included, or you can use your finger), built-in wireless connectivity and a microphone, and probably other stuff that I’ve forgotten.

I will, of course, buy one when it comes out. I really wonder about it, though; it looks like Nintendo is throwing all sorts of random ideas at the machine, and looking to see what sticks. I mean, two screens? Nintendo says things like “you can use the second screen for a map!”, but if that were such a great idea, we’d see lots of games out there using half of their screen real-estate on a map. Or a microphone – as far as games goes, its main use would be for voice recognition, which is just a gimmick. (Maybe some games will use it plus the wireless for communication in multi-player games, which I suppose is a good idea, if long-distance connectivity works well.) Wireless support is sensible enough; the Game Boy family has gotten a lot of mileage out of interconnectivity (I certainly wish I had more friends with Game Boys), and it might as well happen without wires.

The touch screen will presumably make or break it. It’s not at all clear to me how games will be dramatically improved by that, but there were some interesting-sounding demos at E3 this year using that feature. And some stupid ones – you can move by touching the screen with your finger, and fire by tapping! Yeah, or you could just move with the D-pad and fire with the A button… Nintendo sometimes has very good, unexpected game ideas; maybe they really do have a series of interesting games in the works that will use the touch screen.

Or maybe not; maybe they’re just flailing around.

a stronger america

September 23rd, 2004

I saw a bumper sticker the other day saying “Kerry/Edwards: A Stronger America.” Which would seem to be their slogan. And which makes me unhappy.

Don’t get me wrong, there are lots of ways that one could mean that phrase that I would approve of. He could mean that we’re strong enough to share our riches with others. He could mean that we’re strong in friends. He could mean that we’re full of energy, that we’re self-confident enough to convince others when we’re right, to be convinced by others when we’re wrong, and to sometimes amicably disagree.

But that’s not the feeling that I get from the bumper sticker. It reads to me like he’s saying that, under John Kerry, we’ll keep on beefing up our military, and that we’ll beat people up whenever we want to. Which I don’t want – I want our military weaker, not stronger, and I certainly don’t appear of bullying. And it also looks like more of the “I’m just like George Bush, except better” theme, which strikes me as a stupid way to run a campaign.

Sigh. I thought Al Gore was a lousy candidate, but John Kerry isn’t looking too good, either.

hot cha

September 21st, 2004

I was just reading Borgel, by Daniel Pinkwater, when I ran into the phrase “Hot cha”. Which is also the title of a song on They Might Be Giants’ album Flood. Is this a common phrase in some circles? Not that I would be shocked if They Might Be Giants were big Pinkwater fans, but there’s not much internal evidence for that within the song in question.

(Both book and album are recommended, by the way.)

layers and observers

September 19th, 2004

Here’s a question that’s come up at work over the last week or two. A couple of us are trying to rehabilitate some unmaintainable code that’s currently in our product: trying to bring it “From Mud to Structure”, as POSA1 puts it. The obvious pattern to start with is is Layers: we’d like to separate the pieces of software into a core that provides the core functionality that we need and that uses the same classes and patterns as the rest of our system, with an outer layer on top of it that satisfies customer-specific needs (e.g. using CORBA instead of our own RPC system and threading model) and that could be easily changed for different customers.

So: how do adjacent layers communicate? You could have adjacent layers invoke each other via function calls, but that would couple them too tightly. One standard trick to use here is to use the Observer pattern: in one direction, you’re allowed to do function calls, but in the other direction you’re only allowed to publish state change events. (And, of course, information can also be passed in the other direction via return values of function calls.)

But who gets to do function calls, and who is restricted to being observed? You could do it either way (replace a function call foo() by publishing the event that your desiredAction attribute has been set to foo), but presumably one way is more natural than the other. In the situation, it’s pretty obvious: the outer, customer-specific layer frequently wants to invoke customer-neutral functionality in the inner layer, get the results back in a customer-neutral format, and translate them to a customer-specific format. There are also some situations where the inner layer wants to trigger actions in the outer layer: for example, the outer layer may request that the inner layer start a long-running action, and want to know when the action is finished. Which is a classic situation where Observer works well. So, here, it looks like the best solution is for the outer layer to make function calls on the inner layer, and for it also to be an observer of the inner layer.

Is this a general rule, then? If you have a layered architecture, do you want your function calls to always go inward? At work, there’s somebody who sometimes gets annoyed if it looks like we’re doing things that he disagrees with, so I looked to see if he’d written anything on the subject. He gives an example at the other end of a layer architecture – a machine-independent part (of a kernel?) on the outside, and a hardware abstraction layer on the inside. And there, he wants the hal to call and be an observer of the mi layer.

So, some questions:

  • Does this make sense, or should it be reversed? Honestly, here I’m hampered by my lack of experience – it sounds fishy to me, but I’ve never written such software, and the devil is in the details. (It is the case that the person in question thinks about observers fairly differently from me.) One thought experiment is: what if we go down still further, so the outer layer is the hal and the inner layer is the hardware itself? If my understanding of hardware is correct (which it probably isn’t!), we have two communication mechanisms: the hal can read/write memory (and some memory locations may trigger special actions, e.g. disk writes), and the hardware can raise interrupts. If that’s the case, then I’d say that reading and writing memory is more like performing a function call (consider, e.g., replacing a public member variable by a pair of accessors), while an interrupt is more like publishing an event to on observer (“something happened!”).
  • If we do agree with his point of view, is it really inconsistent with the example I’ve given above? In my example, the customer-specific layer was a caller and observer of the customer-independent layer; in his example, the hardware-specific layer was a caller and observer of the hardware-independent layer. Maybe if I thought about it more, I’d decide that we were both right, and come up with a generalization along the lines of X-independent vs. X-specific.
  • Is there really only one correct answer here? POSA1 says no: it’s more common for outer layers to call and observe inner layers, but that the other direction is also possible. (As well as other solutions, e.g. observers everywhere to reduce coupling still further.)

dance class; hdtv

September 18th, 2004

Miranda’s taking dance lessons (tap and ballet for 5-6 year olds). The second one was today. At the first one, I got to see what a girl-dominated world might look like: all 10 kids were girls, 8 of the ten were wearing light pink, one was a mixture of pink and black, and one was all-black. One other parent was male, the rest were female. Much more balanced today, though – more black, a few kids were wearing lavender, and one was dressed in white. And I think there were four fathers there.

On the drive there, while passing some fire trucks: Miranda: “Fire trucks can go through red lights because they’re red!”. Me thinking: Hmm… Miranda: “And taxis can go through yellow lights because they’re yellow!”. Me thinking: That would explain some things, wouldn’t it?

We bought an hdtv last week; I mostly actually wanted to use it as a monitor for 480p inputs and sd cable, but this model did a nice job of upconverting 480p inputs to make them look like 720p, so spending the money for an hdtv monitor was worth it to me. (Not all hdtv monitors did as well, though, so be warned: go to a store and get the sales clerk to plug in a dvd player via the component inputs.) And it actually has a built-in tuner, so I went out and bought an antenna for it. Which I’ve had mixed experiences with so far: it’s amplified, but signals still go in and out sometimes. So, with less amplification, it would go between 0 and 2 bars, while with more amplification it jumps from 0 to 5 bars, but the frequency of 0 bars doesn’t get reduced as much as I’d like.

Right now, though, I’m watching baseball on Fox, and I’ve actually managed to fiddle with the antenna to get a consistent signal. It’s being transmitted as hd, according to the tv, but it sure looks to me like sd. So I’m pretty sure that it’s being recorded with sd cameras. And, ironically, the result is in some ways worse than what I get if I switch the antenna over to cable: the tv recognizes that the cable signal is sd, so it uses its clever machinery to improve the quality of the signal, while it leaves the hd signal as it is. In particular, on the hd signal, the interlacing is pretty obvious, while the tv has circuitry to convert the sd 480i signal to 480p. So there are tradeoffs. (Probably better hdtv receivers have less of an issue with this; for that matter, there’s no technical reason why a tv with a built-in hdtv receiver couldn’t display the signal as 1080p instead of 1080i, I think.) (Edit: actually, MPEG can encode interlacing, so there really is a difference between a 1080i signal and a 1080p signal.)

Still, I’m glad to see that I’m getting a consistent signal here, because presumably the playoffs and world series really will be broadcast in hd.

manny!

September 17th, 2004

Jordan’s comment reminded me that I forgot about his other website. Which, at least currently, links to a page advertising his book, The Grasshopper King. Which I like a lot, so go buy it! I remember enjoying reading the manuscript when we were in grad school together, but in the mists of time I couldn’t remember whether I liked it because he wrote it or because it’s actually good. Fortunately, the latter proved to be the case. My only quibble is that I always feel guilty about enjoying novels set in academia. But I suppose that you should write about what you know; anyways, now that I’ve been out in the real world for a whole year now, I guess I can start getting over that.

Side note to Jordan: at first I assumed the web page was the publisher’s page for the book, but a closer examination showed that not to be the case. What’s your connection with this Zeek magazine that’s hosting it? Who did the web site design?

Anyways, the real reason why I’m typing now instead of reading a book is my happiness at the Red Sox’s victory over the Yankees (at the expense of Mariano Rivera, no less), and at the awesome catch that Manny Ramirez made to take a home run out of the stands. Manny has a bad defensive rep, but he’s actually always been more or less decent defensively. Still, that was probably the best play I’ve seen him make. Good Red Sox crowd, too; it took me a little while to realize that, in fact, the game was in New York. We went to an A’s-Red Sox game a few weeks ago where the crowd as a whole was, I think, slightly tilted towards the Red Sox, and the fans around us were heavily leaning that way. Miranda was highly amused by the simultaneous “Let’s go Red Sox” and “Let’s go Oakland” chants, but her favorite chant of the night was one all the fans could agree on, “Yankees Suck”. She is a fabulous daughter!

art of the fugue

September 16th, 2004

I was listening to the Gustav Leonhardt recording of The Art of the Fugue in the car for the last few days, and I kept on waiting for the unfinished fugue to show up. But it never did! Reading through the liner notes (what is the accepted term for CD booklets?), Leonhardt is of the opinion that the unfinished fugue wasn’t intended to become as part of the work. I hadn’t realized that there was any serious debate on this issue (though it is, I suspose, a bit suspicious that the main theme of the work doesn’t appear in the portion of that fugue that we have); at any rate, I miss it.

Not my favorite recording of The Art of the Fugue; it seems a bit flat to me. (Flat in the sense of “insufficiently textured”, not in the musical sense, of course.) The other recordings on the CD are better, though (Clavierubung II and Prelude, Fugue, and Allegro BWV 998). I’m looking for more recordings of The Art of the Fugue; the other ones I have are the ones by Davitt Moroney (which I quite like) and the partial recording by Glenn Gould, largely on organ, which is dreadful. (At least the organ parts.) Anybody with any favorites?

up and working

September 16th, 2004

Welcome to my blog. It’s implemented using WordPress, which seems pleasantly nice to use. (And is GPL‘d.) Many thanks to the good folks at Red Bean for their assistance, especially Ayse Sercan and Karl Fogel. (While I’m mentioning people, I’ll say hi to Jordan Ellenberg, since he promised to read the thing.)

Great things await. Or not. We’ll see.