[ Content | Sidebar ]

school closure, continued

February 11th, 2005

The school closure saga continues, and it gets stranger every week. Two weeks ago, I liked the school board but was mad at the superintendent. Last week, I was mad at everybody: the school board was just letting the superindentent and her staff talk, without (largely) seriously questioning any aspect of the report and its proposals. (I’m biased, but trust me, there’s stuff in there worth questioning.)

But yesterday was just plain bizarre. First, it turns out that the school board will almost certainly have a few hundred thousand dollars available each year than they thought; at this point, I can see no financial reason for them to close a school next year, and there may not be any financial reason for them to close a school after that, either. At this point, it suddenly turns out that we’re supposed to believe that closing a school, instead of a necessary evil, is actively good! That Slater (the school my daughter attends) is a disaster and the presence of PACT (the special program she’s in) is hurting the neighborhood kids (largely poorer, with lots of English-language learners), but if PACT gets moved to Castro (another school attended by poor kids who are English-language learners), then all of a sudden PACT’s presence will be a huge blessing! That the school district is completely confident that it has suddenly found exactly the right teacher training program to cure all of Castro’s (long standing) woes, despite the fact that we have no actual experience with the program, and that in fact teachers were first exposed to it in a training session two days ago! That, despite the fact that PACT is nothing other than the reification of a particular educational philosophy, it must be the case that, if we disagree with switching over to this newfound gospel, it must be because we’re bigots! Oy.

Anyways, I’m more favorably inclined towards the Superintendent than I had been: I still think she’s pushing a harmful program, but she is doing a fair job of evaluating some of the possible evidence that speaks against the necessity of school closure. I’m quite impressed by two of the trustees (Rosemary Roquero and Fran Kruss, for you local readers), I get angrier every time one of the trustees says anything (Ellen Wheeler), and am disappointed but not giving up hope in the other two (Gloria Higgins, Fiona Walter). At least this soap opera should be over, for better or for worse, by next Wednesday: the discussion has suddenly gotten a lot more heated and serious.

generics in Java

February 8th, 2005

One of the things I was excited to learn about in the new version of Java was how they added generics to the language. I didn’t expect it to be as powerful as C++ templates: that amount of generality, with its associated complications (e.g. having to separately compile separate instantations of the same template, or the parsing problems that arise), doesn’t seem like the Java way. So my guess was that, if a template calls a method on the parametrized type, it would require the parametrized type to inherit from a class (or interface, of course) providing that method. In particular, you wouldn’t be able to get much use out of, say, types that are nested inside the parametrized types: you wouldn’t be able to assume that, say, each type T has a nested type T::iterator.

And, it turns out, I was right! (Incidentally, they sensibly added covariant return types at the same time, to ameliorate some of the potential negative implications of this restriction.) But there’s one twist I hadn’t expected. It hadn’t been at the front of my mind that Java already had one built-in generic type, namely arrays. And what I had completely forgotten is that Java arrays aren’t type-safe! If, say, Manager is a subclass of Employee, then a Java compiler will happily let you pass an array of Managers to a function expecting an array of Employees. Which would be fine if Java had a notion of const arrays, but it doesn’t; and a (non-const) array of Managers doesn’t support the full interface of an array of Employees, because you can add an Employee to the latter, but not the former. Java’s solution is to nonetheless allow you to pass an array of Managers to a function expecting an array of Employees, but to throw an exception at run time if you try to stick a non-Manager Employee into the resulting array.

They did a similarly weird thing with generic types. Say that you have a generic type Generic that’s parametrized by a type T. (Which must inherit from some specific class: we’ll assume it’s Object.) Then you can write Generic in place of Generic<T>, and you can pass an object of any type Generic<T> to a function expecting an object of type Generic. As with arrays, an exception will be thrown if you do something too horribly un-type-safe to the object (though, I think, the details differ somewhat); but, as with arrays, it’s really the sort of thing that should be caught by a compiler in the first place.

So why was this conversion allowed? One motivation is that it would allow you to implement generics without changing the virtual machine; apparently, they decided to change the virtual machine anyways, however. (I don’t know the details here.) And it allowed them to provide generic versions of various classes/interfaces in the standard library without changing their names. And, well, I guess throwing exceptions in certain places where the compiler could catch your mistakes for you is just the Java way of doing things?

All grumbling aside, I’m glad that Java added generics. Non-type-safe collections are pretty passé, even if I wish the new collections were really type-safe instead of only sort of type-safe. The language isn’t so simple that adding generics increases its complexity very much. Part of me thinks it’s too bad that, as far as I can tell, we’re just not going to see in Java the incredible wealth of techniques that C++ templates allow. I expect people to use Java generics in some surprising ways, but I just can’t see how they’ll lead to anything as exciting as we’ve seen in C++. But I guess that’s okay: it’s hardly the only way in which Java is less exciting than C++, and it’s still a quite serviceable language.

grand theft auto: san andreas

February 6th, 2005

I’ve played through somewhere between a third and a half of Grand Theft Auto: San Andreas now. I’m not sure I’m going to finish it, largely because I don’t play it when Miranda is around, but I think I’ve seen enough of it now to say something.

It (preceded, of course, by earlier games in the series, and other games influenced by them) certainly has some important gameplay advances, ones that were new to me. Much of the development of video games, especially once 3D hardware came on the scene, has consisted of giving people larger and larger worlds to explore in, with fewer and fewer artificial barriers. The most dramatic single advance was probably Super Mario 64: before that game, platformers had people starting from the left side of a (quite artificial) world, moving to the right (getting items from boxes and squashing bad guys), until they reach their goal. But in Super Mario 64, levels were 3D areas that you could wander all over in; you had a task to accomplish instead of a location to reach; and you went back to the same level multiple times to accomplish different tasks.

Still, the game was divided up into multiple levels (connected by an overworld), the goals were pretty arbitrary, and, while the levels looked large at the time, they look pretty small a decade later. These issues are all grappled with by GTA:SA (and, presumably, other games in the series), quite successfully. There are no longer individual levels linked by an overworld: the action takes place on one map. (With the slight caveat that some missions have you entering buildings that can be only accessed during that mission.) The goals of missions, instead of being arbitrary, are (largely) designed to advance the plot. And the map is much larger than that of any other game I’ve seen; I haven’t compared the map to those of actual cities, but it wouldn’t surprise me if the number of streets and blocks in the map compared favorably with a medium-size real-world city.

This vastness requires some careful gameplay design: it’s great to have a big world to explore if you’re in the mood to do that, but if you’re in the mood to make progress in the game, the vastness can turn into tedious traversals if you’re not careful. All in all, I think the game’s designers did a good job of dealing with this issue. They broke the map up into three cities (plus some intermediate rural areas); while you can drive anywhere at any time if you want to, the missions at any one time are relatively close together, reducing travel time and encouraging you to become familiar with one specific area of the map. You usually have several different missions to chose from, so if you’re frustrated with one mission for some reason, you can do something else instead. You can buy new houses to serve as save spots in different areas of the map. (Though it can be hard, at least initially, to save enough money to do so; fortunately, most of the time it’s not really necessary, and I was able to save up enough money to buy a house when it really mattered.)

The missions themselves are extremely varied. In the first mission, you just have to get from one place to another without being killed. But soon you’re hunting people, breaking into houses (with either stealth or mayhem in mind), protecting people, delivering items, planting evidence for cops, starting gang wars, racing cars, dancing, evading cops, burning fields of marijuana, piloting radio-controlled airplanes. and who knows what else. I have a hard time thinking of a video game genre that isn’t present here – there are shooting, racing, stealth, rhythm (including one where you have to bounce your car in time to the music), strategy, and rpg elements. You ride bicycles, motorcycles, lots of different kinds of cars and trucks, a combine harvester, planes, and walk. It’s a very varied game.

As I mentioned above, it also has the distinction of being the only game I own that I won’t let Miranda watch. Some people seem to be up in arms over this aspect of the game; I tend to think that people like that are ridiculous. Why would you expect an art form to limit its productions to those that can be appreciated by 5-year-olds? Surely that would be a sign of intellectual bankruptcy? (As would, of course, a form that can’t produce works that can be appreciated by 5-year-olds.) Do these same people want me to only own movies that 5-year-olds can watch? Or only read books that 5-year-olds would like? The mind boggles.

As is obvious from the list of activities presented above, your character in the game does lots of things that would be considered horrible in real life. The game can hardly be considered as showing uncritical approval of these actions, however. One recent article I read complained that in the game, you can make progress by stealing cars and shooting policeman. I doubt that the reviewer in question (unlike Alison Bechdel) has actually played any of the game (shooting policemen, in particular, actually isn’t a major component of the game, and in most situations is more likely to hinder your progress than to help it), but in fact these actions are presented in a much more problematic fashion in GTA than in most other games. It is no exaggeration, I think, to say that looting and vigilanteism have been major themes throughout the history of video games: in the Colossal Cave adventure, you were supposed to take all the treasures you could find in the cave, with no thought of whom they might belong to. In the Zelda or Mario games, you look for items wherever you can find them: for example, in Zelda games, whenever you go into people’s houses, you break their pots hoping to find money or items, and you open their chests searching for treasures to take. When wandering through the countryside, you’re encouraged to kill everybody you meet, partly for defensive reasons, but partly just to get stuff. (Indeed, if those games were written from a different point of view, then “vigilanteism” would be far too kind a description: thuggery and amoral killing might fit the bill better.)

So, yes, in GTA, you steal a car whenever you want to get somewhere: you don’t have your own car that you actually take care of. But the very realism of the game means that you can hardly ignore the moral implications of your actions, and what would happen if everybody acted the way you were. Every time you bump into another car, your character makes a quip along the lines of how the other driver got their license, but of course you’re the one at fault, not the other driver. And in the first quarter or so of the game, when you frequently have passengers along on your trips, those passengers make fun of what a bad driver you are.

Similarly, a reviewer who hadn’t actually played the games could pretend that, for example, they valorize gang violence. And, in fact, in the first portion of the game, you do spend time building up your gang, and getting a fair amount of power and profit while doing so. But the end of this part of the game, that’s all in ruins: your gang is destroyed, two of your closest friends were really police stool pigeons, your brother is getting raped in jail, and you’ve only survived because some corrupt policemen think that you can be more useful doing their dirty work for them instead of rotting in jail. (Incidentally, in later sessions of the game, the main character moves out of gang warfare into the fringes of more organized crime, and you make a lot more money that way: again, hardly an uncritical endorsement of gang life.)

The best example of this problematization is in the character of OG Loc. When we first see him, he’s just gotten out of jail, and our job is to kill the person who raped him in jail. He’s trying to stay out of trouble from his parole officer, but he really wants to be a gangsta rapper, and is constantly going on about how he knows life on the streets, how he’s keeping it real. We usually hear him saying this while wearing the uniform of a fast food joint where he’s working, however. It’s typically followed by some awful rhymes that he spouts; his solution to his lack of success as a rapper is, instead of improving his skills, to steal lyrics from other people, and to kill other rappers’ managers. At the end of the first section, he’s decided that he can’t take the life of a fast food worker (which I certainly sympathize with), and that he would rather be an “ass technician” in jail instead of a “fry technician”, that he wants to “keep it real” by going back to jail.

Later in the game, we get to hear OG Loc in a radio interview. He’s apparently gotten out of jail and is a little more successful, and still can’t stop talking about how he knows life on the streets, how he’s keeping it real, accompanied by derogatory comments about women. The interviewer finds this ridiculous; as he points out, we all grew up with a street outside of our front door. So OG Loc pulls a gun on the interviewer in the studio; the interviewer takes back everything he said, saying that he didn’t mean to imply that OG Loc’s women weren’t all “bitches” and “hos”.

Which brings us to the role of women in the game. They are, of course, presented in a fashion that would give pause to anybody with a hint of feminist consciousness. But, as in the last paragraph, that viewpoint is treated in a far from uncritical fashion. And while most of the major characters in the game are male, I’ve seen three important female characters so far. One of them, Denise, isn’t too interesting. The other two that I’ve seen so far, however, are quite strong female characters: Catalina, while apparently insane, is also extremely competent (and easily bosses the main character around), while Kendl, the main character’s sister, is the most sensible person I’ve met in the game, and the only person with a real vision for how to make money and advance in life without crime.

There’s a lot of good stuff here: both in terms of video game gameplay advances and in terms of the sophistication of its plot and its approach towards real-world themes. Before playing the game, I suspected that the GTA series were the most important games of this generation of consoles; now, I’m sure of it.

school closure

January 28th, 2005

The full report of the school closure task force came out last Tuesday, so I’ve been busy writing to the school board, and I spent almost six hours at the school board meeting last night. I actually was pretty impressed by a lot of things that I saw there. Members of the public (including your humble scribe) spoke for three hours; people made a lot of good points, and repeated each other remarkably little given the length of comments. I also liked what I saw from the school board: they were clearly paying attention throughout the comment period, following along in the report when people referred to specific aspects of the report’s evidence or logic. After the public comment, the school board members clearly felt that they needed a lot more information than they had, so they decided to devote next week’s meeting to investigating evidence and digging into issues that people had raised, instead of proceeding to a vote as planned.

I can’t say that I was too impressed by the superintendent, however: in particular, she seems to have a habit of defining words to mean what she wants them to mean, instead of what the rest of the world thinks that they mean. The best example of this is in the press release that her office issued about the report: it says that

the over-arching goal was to make a closure decision that was the least disruptive

(emphasis in original) and then proceeded to outline a plan that wouldn’t simply close a single school (as was the plan, and as the rest of the task force thought they were deciding) but would, in addition, gut a second school, and ensure that students at that second school would have to change schools in third grade for the indefinite future, unlike all other schools in the district. She tried to ease the disconnect by following the above quote with

– meaning that it promoted the best learning environment for all students

but of course, as laudable as the latter goal might be, it simply is a completely different goal from minimizing disruption. (And I am personally not at all convinced that her plan met the latter goal, either.)

This curious use of language wasn’t confined to the press release, either. In response to complaints about the facts that the task force at times held their discussions in closed sessions, she explained that, in fact, the meetings were always open sessions. At this point, my jaw quite literally dropped, and I let out an involuntary squeak (which earned me a bit of a glare); while I’m aware of the expression, this is the first time in the life that I’ve had that involuntary physiological reaction myself. She then further explained that, by “open meeting”, she meant that people were allowed to speak in public for an hour before they were all ushered out, the doors were closed and windows covered, and the rest of the meeting proceeded in private. Which is, I think, not the way that most of us understand the phrase.

Anyways, I guess I’m attending school board meetings for the indefinite future; seeing how they work, I’m actually rather interested. And, as I said a while back, I’d been feeling that I should get involved with local politics a bit more…

const, and iterators

January 24th, 2005

One thing from C++ that I miss in Java is the notion of ‘const’. As I commented earlier, I’m always worried when I return an object that I’m exposing too much of my internals. If I had const to help, it might not be so bad, because I could return const objects, but I don’t have that to help me.

Still, while I like const, it’s a bit of a special case, so maybe I can accept it in the name of simplification. What bothers me more is that similar flaws show up in the library, in situations where they could be easily avoided. In particular, unlike the STL, there’s no iterator / const_iterator distinction. In Java, the Iterator interface has a remove operation; while the documentation marks it as an “optional operation”, saying that you can throw an UnsupportedOperationException, that’s not the way interfaces should work: if a class doesn’t support an operation, then that operation shouldn’t be part of its interface! That’s what static typing is all about!

Java’s Iterator interface is actually a little weird. I’m not that thrilled with the idea of combining the notions of retrieving the current element and advancing the iterators into a single operation. I guess I’ve started to buy into the notion of “Command/Query Separation”; while it’s not as important in Java as in C++, because you don’t have potentially expensive/exception-throwing copy constructors to deal with, it still seems a little unclean to put the two together, and couldn’t there be situations where you want to retrieve the current element without advancing the iterator? Also, it makes for loops look funny, because the third part is missing.

Of course, Java 5 introduced a new kind of for loop, saving you the trouble of doing all the checking and advancing yourself. Which I will also grumble about – it actually doesn’t take an Iterator as an argument! Instead, it takes a Collection (well, an Iterable) as an argument, which it gets an Iterator from (behind your back) by calling its iterator() method. This may save you typing much of the time, but it limits your flexibility – what if, for example, you want to iterate over elements of a list in reverse order? (Hmm: it looks like Java lists don’t actually support doing that by returning a separate reverse iterator object – instead, they return a ListIterator which allows you to go both forwards and backwards. Which is a useful capability, but it would still be nice at times to turn one into a normal Iterator running backwards.) Or what if you wanted to have an InputStream-like class that provided an Iterator interface?

The Java book I was reading touched on this issue, I think – they comment that Java frequently uses Collections where other people expect Iterators, on the grounds that that’s usually what you have around, and in a general interface, you might as well expose the more powerful notion. Which is a reasonable argument, I suppose, for returning Collections where I might be tempted to return an Iterator. (Which gives rise to the same worries about constness that I complained about above, with the same solution: the modification operations for Collection are “optional”, and the language even provides an unmodifiableCollection() function to turn a modifiable Collection into an unmodifiable one.) But it’s not a reasonable argument for interfaces to require a Collection when they only need the functionality of an Iterator: you’re just throwing away generality in that case.

Sigh. I guess, after the STL, most collection frameworks are likely to be a bit of a let-down.

not the best week

January 22nd, 2005

Thursday, a week and a half ago, we had our monthly classroom meeting (for Miranda’s kindergarten class). And we learned that Miranda’s school is probably going to be closed next year. It was public knowledge that one school was going to be closed, but I had kind of been in denial over the issue – even if Slater were the school chosen for closure PACT (the parent participation program that we’re in) would move to another school, and I can’t imagine that very many people want their kid’s school to be closed, and what reason do I have to think that Slater deserves to stay open more than any other school?

Confronted with the likelihood that Slater actually will close, however, I quickly realized that I didn’t think Slater should close; besides PACT, the principal is great, and Liping Ma is working with the teachers to improve their math teaching, which really excited me when I heard about it.

Anyways, Thursday night’s sleep was interrupted by Miranda puking. Then, on Sunday, it was my turn to get the stomach bug. Then, that evening, I heard some dripping in the fireplace; at first I assumed that it was raining outside, but when I walked the dogs, it was dry out. So then, the question is “what is above the fireplace that could cause dripping?”, to which the answer is “the water heater!”. Fortunately, I was staying home on Monday anyways (both because of illness and because of MLK day); it took a little longer than expected, but we now have a new water heater. Actually, it’s just as well that it was replaced now: it turned the old one had its pipes hooked up backwards, which was why the hot water only lasted about one shower’s worth, so I’m glad that’s fixed. (And I’m also glad that it failed with a slow drip while I was at home instead of in a more catastrophic fashion.)

On Tuesday, I went to a school closure task force meeting and had my say in the public comment period. (The actual deliberations were closed to the public, which rather bothers me – I thought California had a law forbidding that?) On Friday, it was Liesl’s turn to get the stomach bug – I devoutly hope that it’s the same bug instead of an exciting new one that Miranda and I will get to go through ourselves…

Still, we’re all on the mend now. We’ll learn on Tuesday what the school closure task force recommends; no matter what, I expect that I’ll be going to school board meetings the next two Thursdays. (I’ve already sent a long e-mail to the school board; I’ve also been pleased at the attention the press is paying to the matter.) And, if Slater is closed, we’ll survive; PACT will probably have a somewhat bumpy year next year, but I far prefer a bumpy year of PACT to a normal year in a normal classroom…

almost everything is an Object

January 12th, 2005

One not very graceful aspect of Java: everything is an Object, except for things that aren’t. (A few basic types: integers of various sizes, floats, booleans, characters, maybe one or two other things that I’m forgetting.) Why is that? The reasons must have something to do with making operations on those basic types more efficient, of course. For example, assuming that you’re on a 32-bit machine, you’d like to be able to store an arrays of 5 integers in only 20 bytes, to be able to add two integers with a single machine operation, etc. So, even if your integer type were to allow method calls (in particular, were to support the methods that Object requires), you wouldn’t want the method calls to be accessed via the normal method call mechanism. Or, perhaps on a more basic level, you would need a mechanism to avoid heap allocation for integer objects.

One way to avoid heap allocation for integer objects but to support it for other kinds of objects is via tagging: if you have a 32-bit value in memory, then the bottom couple of bits tell you if the value is a pointer to an object, an integer, a character, etc. One problem with that is that you lose a couple of bits, so you can only support 30-bit integers via this mechanism. Which is fine for languages like Scheme with arbitrary precision integer arithmetic (so this is just an optimization), but not suitable for Java where integers are defined to have exactly 32 bits of precision. The thing is, though, that’s irrelevant to the Java example, for a couple of reasons, the most basic of which is that I’ve used the word “object” in a completely generic sense in this paragraph, simply meaning “datatype”, which has nothing to do with the existence or lack thereof of an inheritance relationship. The second reason is that Java’s implementation model goes through the Java virtual machine, and while I know next to nothing about it, I’m pretty sure that it has enough strong typing to make type tagging unnecessary. (Otherwise, I don’t see how it could be as secure and efficient as it is claimed to be: either, sure, but not both.)

So that last paragraph was a waste of speculation. And, in fact, Java’s own (as opposed to the JVM’s) strong typing means that you should be able to normally do operations on integers very efficiently, even if integer were thought of as a subclass of Object: when you pass an integer to a function expecting an Object, then at that point the compiler could stick some goop around it to make it behave like an instance of a normal class, but if you’re passing it to a function expecting integers as arguments, then the compiler wouldn’t need to insert that goop. (As is, Java already has classes that correspond to basic types with enough goop added to turn them into honest Objects; in fact, Java 5 does this conversion automatically for you in some circumstances, though by no means all, or even (if I recall correctly) many.)

What flaws would a scheme like that have? It would cause memory allocation to occur behind the scenes in some situations; this might have some surprising consequences at times (in particular, allowing an OutOfMemoryError to be thrown when passing an integer to certain functions), but I don’t think that would be a show-stopper. Equality would be a little delicate: given functions

bool equal( int a, int b ) { return a == b; }

and

bool equalObj( Object a, Object b ) { return a == b; }

you’d certainly want equal(5,5) to hold, and presumably would also want equalObj(5,5) to hold; the latter would make equality testing a little less efficient in some circumstances than it currently is, but I don’t think that’s a bit deal. (Especially since it would only slow down equality testing for variables of type Object: if you know a more specific type, then you’d be safe.)

It would also interact badly with one aspect of Java’s arrays, but that’s a misfeature that I’ll probably whine about in the future.

So I guess I still don’t understand why they didn’t just make everything an Object. Then again, one can ask why I care? If pressed, I would tend to land on the side of languages without a universal superclass. Having said that, I’m not sure I would encourage all languages to provide generic types that are as powerful as C++ templates, and for languages without a mechanism of that power, it will unfortunately be the case that having a class like Object is a necessary evil, in which case you’d want Object to be a universal superclass for all types, not just a superclass for all types except for a few weirdos.

frances hodgson burnett

January 10th, 2005

Ever since we went to see a musical version of A Little Princess, I’ve been on a Frances Hodgson Burnett reading kick. I never read any of her books when I was a kid, but now that I’m giving them a try, I really like the ones I’ve read four so far (A Little Princess, The Secret Garden, The Lost Prince, and Little Lord Fauntleroy). They all follow a similar formula: the main character is a child (10 years old or a little younger?), of excellent character whom almost everybody (adult and child) adores, at least one significant change of fortune (with family, in particular removal from parents, typically playing a key role), everything turns out all right in the end for the main character as well as one follower who has been uplifted by contact with said character. Not a bad formula for children’s books, and quite well executed in all her books I’ve read.

It looks like several of her books are available via Project Gutenberg, for all you etext fans out there.

Other things I’ve enjoyed recently:

  1. The Incredibles. I’m not sure if it or Monsters, Inc. is my favorite Pixar movie, but I had a great time. A bit much for Miranda, though she was brave through it.
  2. Philadelphia Chickens. They are indeed remarkable cows. And remarkable aardvarks. And on and on…

java: what is an object? what is a variable?

January 5th, 2005

This is the first of a series of Java posts, occasioned by the fact that I’m doing some Java programming for the first time in a few years.

When I first started using C++, I thought that its insistence on supporting objects that aren’t held via pointers was, frankly, a little weird. The languages that I’d probably spent the most time with prior to C++ were C and Scheme. In C, you can of course pass structs by value and allocate them on the stack, but most of the time you pass structs via pointers. And in Scheme, there isn’t a notion of objects stored on the stack at all. In C++, though, the language support for objects on the stack is front and center: the copy constructor and the assignment operator are so important that the compiler will provide them for you if you don’t define them yourself, and referenecs are omnipresent, used to get the efficiency of passing via pointer without having to explicitly take an address. So I wondered if it was a good idea, or if it was a misguided legacy of of structs in C. Why not use a simple syntax for referring to C++ objects but have them be heap-allocated behind your back, like in Scheme?

I got used to it, though. Actually, you construct objects directly in C++ much more often than you construct structs directly in C: you construct objects on the stack all the time, and it’s quite common for data members of classes to be classes. (As opposed to C, where it’s not nearly as common for a struct to have a struct as a data member.) Of course, you could have the same appearance while having heap allocation everywhere behind your back, but the more I thought about it, the less appropriate that seemed for a C offshoot: it would go against the language’s obsession with efficiency, and it might not be possible without garbage collection. (Which is another thing that I used to love, but learning C++ has made me realize that garbage collection is much more of a mixed bag than I used to think. Maybe I’ll post on that some other time.)

And now I’m using Java, and I find myself brainwashed by C++. I’m constantly worrying about returning objects – is it safe to return them without cloning them, or am I exposing too much of my internal implementation? (Which has bitten me: my last Java project involved writing a toy compiler, and program-level testing turned up something like two or three bugs that made it through the unit tests; not cloning was at the root of one of them.) And typing ‘new’ all the time bugs me. And while Java does have an analogue of the copy constructor, namely Object.clone(), it’s not nearly as easy to use. At least I think it isn’t, though I haven’t implemented it frequently enough to be sure; the techniques and division of responsibilities involved just seem bizarre to me.

Still, I’m sure I’ll get used to it soon enough, and the fact that C++ has both references and pointers has to be a sign of a design flaw. Probably Object.clone is also a design flaw, and (assuming that I accepted garbage collection) I’d ultimately prefer a language that was more like Java but with Object.clone behaving more like a C++ copy constructor. For that matter, I suppose there’s nothing preventing me in Java from doing copy constructors of my own; it might be tedious without compiler support, though. Maybe I’ll give it a try, and see if I can end up at a happy medium.

free math books

January 1st, 2005

Some friends of mine were over for dinner the other day, and one of them (Ravi Vakil) was asking me about possible licenses for an algebraic geometry book he was thinking of writing. He’d like it to be freely available, so (for example) students could download it, though he doesn’t actually want to put it in the public domain. (Which was my first recommendation, under the influence of this article by Karl Fogel.)

For software, of course, I’d have lots of recommendations: the GPL is one obvious possibility, but hardly the only one. For books, though, it’s not so clear; the FSF has something called the GFDL, but I don’t particularly like it. (I wouldn’t necessarily call it a free license at all; it certainly doesn’t allow others nearly the range of possibilities as the GPL does, though admittedly it’s not clear whether or not Ravi wants to allow other users those possibilities, either.) One source of possible licenses that I found was Creative Commons; are there other good sources out there?

As Ravi commented, he’d like to have the book already be freely available when he’s shopping it around to publishers, to present them with a fait accompli. Which makes me wonder: are there reputable scholarly publishers out there that allow their authors to make the books in question freely available in electronic editions? In my experience, scholarly publishers are in the dark ages when it comes to these matters: they still try (and succeed) to wrest the copyright of works they publish from the works’ authors. Which is ridiculous.

How hard would it be to start a mathematical press, for the twin purposes of giving rights to authors and of encouraging as wide a distribution as possible? (Which are, of course, conflicting goals.) If I could find some friends to help, I could imagine trying such a thing in a couple of years. Of course, there may already be enough people out there trying to do the same thing that it would be more effective to join onto an existing effort.

disgusting food

December 27th, 2004

A new cookbook we got had a recipe for gorgonzola and walnut “ice cream” that we tried last weekend. It looked a little strange: cream together 4 ounces of dolce latte gorgonzola, 8 ounces of mascarpone, add a half-cup of chopped walnuts, whip and fold in a half-cup of cream, and freeze. But all the ingredients are things that I like, the other recipe I’ve tried from the cookbook (meringue chocolate chunk cookies) worked well, and she’s one of the authors of one of my favorite cookbooks.

Sad to say, it was awful. Miranda had several bites of it. Liesl’s mom thought that it might be okay at the start of a meal. Frankly, though, I thought that the combination of whipped cream and gorgonzola was almost nauseating. Admittedly, the gorgonzola we used, while good, wasn’t labeled as “dolce latte”; if I ever run into the stuff, I’ll give it a try and see if I think it would work well enough in this recipe to be worth trying again. But I’m not optimistic…

the programming bug strikes

December 24th, 2004

On my way home from work today, I bought a (two-part) Java book. Nice to see that there’s a decent book out already covering Java 5 – typesafe collections are a good think. And I also got an XML book, which was actually written by a friend of mine; I’m sure it’s no Lambda Expressway, but then again what is? So I guess that’s what I’m doing over the holidays…

organizing information

December 22nd, 2004

Whenever you rip a CD with iTunes, it looks up information about the contents of the CD in Gracenote’s CDDB: as hard as it is to believe in this world of digital information, a CD contains no information about its contents other than the number and length of its tracks and, of course, the music data itself. I have political reservations about CDDB, unfortunately: it started as a free project, and many people (including myself) happily contributed data to the database, but now it’s private. Also, I believe they’ve filed software patents covering their techniques (and are trying to use those patents to squelch others).

Those issues aside, though, my experience with the database is much better than my experience with other online CD databases over the years (including earlier incarnations of CDDB). I have yet to stump it; while it’s not too surprising that it knows about Beatles albums, I’ve also tried foreign CDs (some Herbert Groenemeyer, the Katamari Damashii soundtrack), and it knew about them (giving me the option of either Japanese or English titles for the latter). And it hasn’t been stumped by some of the more obscure (I assume) CDs I’ve tried, such as the excellent Trilectic or this CD of erhu music by Zhao Rongchun that I can’t even find on Amazon. (Hmm: come to think of it, it’s entirely possible that I entered the data for the latter CD into their database myself years ago…)

Having said that, their information is by no means perfect. They list Herbert Groenemeyer variously as “Herbert Groenemeyer”, “Groenemeyer, Herbert”, or simply “Groenemeyer”. (With the genre listed as jazz, world, or pop.) And the information they list for (both of) the Glenn Gould Goldberg recordings is just bizarre: they have “Goldberg Variations” as the title of each track, with what should be the track names (“Variation XXI”) listed as the artist for the track!

I can edit this information myself in iTunes. But I wish it were easier to do so, and I can just see myself having to do the same thing again in a few years when re-ripping the CDs in some other context. Wouldn’t it be better if I were to keep my own private database about all the CDs that I own, and then use that to generate the metadata that the iPod needs? My understanding is that it keeps all this information in an XML file: surely I should be able to write software to generate that out of my own database? Which I would probably also store in an XML file: it seems well-suited to the purpose, and I really should learn about XML anyways.

So: how should I organize the information? The Herbert Groenemeyer example points at one key rule: every entity should have a unique representation in the database. So if I decide that, say, I should switch from “Bach” to “Bach, J. S.” or “Bach, Johann Sebastian”, everything should be updated seamlessly.

The Goldberg Variation example raises another point: a CD isn’t just a CD, it’s a distribution of a recording of a particular piece. I would probably want to have one entity representing the composition itself, another entity representing, say, Glenn Gould’s 1955 recording of the composition, and a third entity representing something even more concrete (the actual CD I own, as opposed to a record of it that was released in the 1950’s). Exactly what this third entity should represent isn’t entirely clear, however, and one can imagine multiple levels here: a CD version is probably different from a record version, but is an older CD remastering of the recording different from a newer CD remastering of the recording? Is the same remastering but with a different booklet the same thing? Should I have this third entity at all, or just make my distinction at the level of recordings instead of releases?

And if I’m building a CD database, why not extend it to other media? I have all these books, and if my house burns down I’m going to want to have a record of them to show the insurance company. And every time I finish a book, I rate it at Amazon (and have, in the past, rated it at other web sites): I really would like to keep track of those ratings, both for my own purposes (so I don’t have to re-enter them again if I find a better web site for recommendations) and to, say, stick them on my web page (here are the last 20 books David read, with their ratings). How should the book organizations be similar to or different than the CD organizations: can we make a distinction between the story contained in a physical book (which is like a musical composition) versus an edition of that story (which is like a recording) versus a physical book or a specific printing of the book (which is like a CD)?

I could go on for a while (creating “virtual CD’s”, populating the database by snarfing info from Amazon, the roles XSLT might play), but I’ll stop for now. I have some free time coming up at the end of the month; maybe I’ll try to cobble together some simple software over the holidays. Despite the iPod being the motivating example, though, I think I’ll start with organizing my book collection first. I guess I should go out and buy a book about XML (and XSLT), and one or more Java books (since, for example, the books that I have don’t talk about GUIs).

electronics miscellany

December 20th, 2004

The DVR developed a new failure mode yesterday – it forgot the TV schedule for the next week and all the recordings we had scheduled. Sigh. Electronics are getting too complicated these days. There is an update for the software available for it; it doesn’t say anything about that problem (or the DVR strange recording / crashing problem I’ve had), but maybe it fixes it anyways.

And when I went out jogging with the iPod yesterday, it skipped over several of the songs. Googling suggests that carrying it in your hand or on an armband will cause it to skip less. I guess it had the first several songs in its buffer, but then didn’t like the jostling so it refused to read further songs until I paused (and eventually held it in my hand). Fortunately, holding it in my hand is comfortable enough.

And now Mulder is gone. Various Hudson trades had been bandered about, but this one was a total shock. I’m still not giving up hope for next year – Rich Harden was starting to look quite good last year, and our hitting and relief pitching will probably be better than last year, but it’s a downer nonetheless.

hudson; ipod

December 17th, 2004

I hope that Atlanta fans are happy right now; I’m certainly not. Was that really the best we could get for Tim Hudson? Was that really better than keeping him around for another year, or for that matter signing him long-term? Sigh. (And the Yankees seem to have wriggled out from under the Jaret Wright signing.)

When importing stuff on the iPod yesterday, it imported the first song at high speed, then slowed to a crawl for the rest. At about the time that it slowed to a crawl, the fan turned on. (Well, one of them – I was afraid that one was busted, but both seem to be working today, so maybe the machine doesn’t always turn both on.) So my theory is that some power management stuff kicked in to lower the processor speed. And, actually, I’d been thinking the computer was slow ever since I upgraded to Fedora Core 2; I’d been blaming that on the upgrade (maybe the new version of Galeon is slower, or something), but maybe something weird is going on with power management. Anyways, when I rebooted the computer I told it to always leave the CPU at full speed when the machine is plugged in; maybe that will help. I haven’t imported anything since then, but my web browsing today does seem speedier.

Though there is a new iPod down side – I listened to it while jogging yesterday, which was great, except that the last song on the album (Beatles for Sale, which like their other early albums isn’t too impressive) didn’t play: it showed up in the track listing, but when I tried to play it, the iPod just ended the album. When I looked at it under iTunes, it seemed fine, and would play, but obviously something went wrong. Anyways, I deleted it on the iPod and told iTunes to resync, and now it seems to play fine. I’ll have to keep my eyes open for this sort of thing in the future; maybe I somehow wasn’t careful when disconnecting the iPod once?

i pod people

December 15th, 2004

About a year ago, I started toying with the idea of getting an MP3 player: I’d recently taken up jogging (and I’m still doing it, a year later), and jogging is really boring. But after toying with the idea for a while, I gave it up, because none of the available players seemed to have a convincing set of features for the price I wanted. Fortunately, however, I won an iPod yesterday at a holiday party at work, and a free iPod definitely scores well on both features and price.

To be honest, my experience so far has been a bit mixed. For now, I’m putting off getting it to work under Linux: I’m controlling it via Apple’s iTunes software on Windows. Installing the software was reasonably straightforward, but there were a few glitches, like the time when the iPod installer wanted me to reboot my computer while the iTunes installer (which had been started by the iPod installer) was merrily chugging away. And once I had all that installed, I then downloaded a software upgrade for the iPod itself; after I’d done that, I wondered if that upgrade was solely for the purpose of preventing me from buying songs from Real Networks. Which I certainly have philosophical obejctions to, though it won’t make a practical difference since I don’t plan to buy songs in non-CD formats from anybody…

The software itself mostly works well, but there are some strange glitches. When I first put in a CD, it happily (and fairly quickly) converted the contents into MP3s. But then I ejected the CD and put in another one, and it refused to acknowledge that I’d changed CDs. I went through all the menus, and I can’t figure out what I should have done: there doesn’t seem to be a “look at the damn CD drive” option anywhere. So, for now, I’m exiting iTunes and reentering it every time I change CDs.

Also, I initially told iTunes not to automatically sync my hard drive with the iPod: my hard drive actually has less space than the iPod (it’s only a 20GB iPod, but it’s a two-year-old laptop with most of the disk space devoted to Linux), and I certainly want to be able to delete music from the laptop without deleting them from the iPod. The software has an option to let you manage the synchronization manually, but I couldn’t figure out how to get it to work; so I gave up and turned on automatic synchronization. (Which still seems not to be completely automatic: it turns on when I either start iTunes or plug in the iPod, but not after I’ve just ripped a CD.) Very strange.

And then today it was only managing to rip CDs at about 1-1.5x, instead of the 4-5x that I got yesterday! I have no idea what’s up with that, but it’s really annoying – it’s bad enough to have to ever boot Windows on this machine, but to be stuck in Windows when I’d much rather be using Linux just sucks.

My iPod isn’t just a normal iPod, either, it’s a U2 Special Edition one. Woo-hoo. So it’s a less attractive black and red, has signatures on the back, and comes with a $50 coupon (valid only for 120 days) on a $150 music purchase that I have no desire to make. I’m not actively against U2 – if it, say, came preloaded with U2 music, then I wouldn’t actually delete it, and I still have a few of their CDs that I bought in high school – but I can’t say that I appreciate being turned into an ad for the band.

All grumbling aside, I do think I’ll like it a lot. It’s nice and small; it’s denser than I expected, but is still quite light enough that I should be able to jog with it fine. The user interface for the machine itself looks pretty good. I’ll have to go out and buy a carrying case, and maybe a remote for it. And maybe a 4-pin to 6-pin firewire connector – my laptop only has USB1 and 4-pin firewire, while the iPod prefers USB2 or 6-pin firewire, though the speed of the USB1 connection hasn’t been a problem for now, given that ripping the CDs is by far the limiting stage involved in getting music into the machine.

paper mario 2

December 13th, 2004

As mentioned before, we’ve finished Paper Mario 2. Which is a bit of an event: it is, by my count, the fifth video game that Liesl has ever finished. Though it’s not as surprising as that statistic makes it seem: two of the previous games that she finished were the original Paper Mario and the not-entirely-unrelated Mario and Luigi: Superstar Saga. The other two games, for the curious, are the two Golden Sun games, which I heartily recommend. What the Paper Mario and Golden Sun games have in common, as far as I can tell, is that they’re RPGs where you can use your special abilities (magic and equivalents) on non-battle screens as well as in battles, giving rise to Zelda-style dungeons. (The Zelda games fall into the category of games that Liesl starts but doesn’t finish; I’m not sure she’s even started any RPGs other than the ones discussed here, though admittedly we don’t have a lot of them around the house.)

So what’s the verdict? It’s obviously a pretty good game, or we wouldn’t have finished it. It does a lot of things in somewhat non-traditional RPG fashion, often with superior results. Aside from being able to use magic anywhere, I particularly appreciate the fact that monsters are visible. The fact that they don’t respawn in dungeons doesn’t hurt, either.

And lots of the RPG mainstays are given enough of a spin to be somewhat fresh: one of the dungeons isn’t a dungeon at all, another one is nicely mxed up with the associated overworld/city areas. I like the inter-chapter scenes featuring Peach and Bowser. It’s nicely balanced – as my ability to buy video games increases, I no longer have much tolerance for games whose play time is extended by mindless difficulty. (Or even, at times, mindful difficulty…) The Luigi appearences are pretty funny.

Having said that, while I quite enjoyed the game, I wasn’t blown away by it. Not much has changed since the first game; there are many worse things in the world than a video game sequel repeating the virtues of a well-done original, but it’s not the ideal that I hope for. I liked the relative lack of annoying overworlds, but the cities aren’t as strong as I’d hoped. The main city has some amount of territory to explore; the other cities are tiny. There are side quests, but they’re frequently tedious and don’t advance the plot at all.

And speaking of plots, that’s one advance in modern RPGs that Paper Mario has completely missed out on: the increased focus on plots. Princess Peach has gotten kidnapped; surprise, surprise. Yes, it’s not Bowser doing the capturing, but we’ve seen that slight twist before. There’s some nonsense about saving the world, but it’s hardly convincing, certainly not enough to make up for the lack of imagination in the “find the seven crystal stars” idea.

Also, while I’m complaining, it (admittedly, like most other RPGs) hits on one of my pet peeves – what’s the deal with having a large party but not letting you use all of them in battle? What are the other characters doing while you and your chosen primary companion(s) are fighting – eating popcorn and betting on the outcome? At least Paper Mario doesn’t have the character balancing issues that this can lead to in other games, since experience points only affect the main character, but I don’t get the idea behind giving you lots of characters without letting you actually use them. Of course, the answer is that it would be tedious to manage tons of characters in every battle, and it would be hard to balance regular battles with boss battles that way, but wouldn’t a better answer be to limit the number of sidekicks? (Maybe that would lead to a more concentrated and more effective plot, too…)

Better presentation would have helped, too. They’ve gone about as far as they can with this 2D-in-3D shtick; while voice acting might be out of place in this game, it might not, and I can’t help but wonder if the 2D thing is used as an excuse to skimp on production values elsewhere instead of as a strong design choice of its own.

All kvetching aside, I had a lot of fun with it, and it was one of the better games that I’ve played this year. I just wish Nintendo would get out of some of the ruts they’re in.

random access, top hat

December 8th, 2004

When talking about the new DVD/DVR, I forgot to mention one advance: improvements in random access. DVDs aren’t better than video tapes just because they look better: they’re better because you don’t have to rewind them, you can jump to any scene (once you get past the annoying ads at the beginning), because they look good when paused. Similarly, this DVR is better than a VCR because you can delete shows in any order, and because it has buttons to let you jump forward or backwards by 30 seconds, making it easy to skip commercials. We pretty much never use the fast forward / rewind buttons on it.

Having said that, improvements are possible. For example, when browsing through the saved programs, it gives you 5 different options for sorting them, but none of them are what we want, namely reverse chronological order. (I have a hard time believing that wanting to watch the oldest shows first makes us some sort of freaks.) Also, they divided the saved shows up into screens, but there’s no way to scroll a page at a time instead of a screen at a time.

We went to Top Hat last week. Very good: quite similar to The Gay Divorcee, but everything about it is a little better. More songs, better songs, better dance sequences, the plot makes a bit more sense, and I really like the wife of Edward Everett Horton’s character. (Played by Helen Broderick, apparently; never heard of her.)

I’m very glad the Yankees signed Jaret Wright for too much money (not that money matters to the Yankees). Last year was obviously a combination of fluke / Leo Mazzone; that deal’s going to look pretty stupid six months from now, never mind three years from now.

adventure games and rpgs

December 6th, 2004

We’re done with Paper Mario 2 now (and I’m starting Metroid Prime 2 – what an amazingly bad menu system!), so I should probably continue talking about it. It’s such a quietly unusual game, though, that I think I have a couple of entries’ worth of material about it.

Maybe it’s not that unusual; it is quite unconventional for an RPG, but now that I think about it, several of its non-RPG elements are actually fairly normal in adventure games (such as the Zelda games).

So: a comparison of the genres.

  • Both typically have you exploring in cities, overworlds, and dungeons.
  • Both can have fairly strong plots.
  • RPGs have a leveling-up system, controlled by experience points; adventure games have you gaining new abilities via items.
  • Both have a sort of HP system, but it’s finer-grained in RPGs; in RPGs, it’s tied to leveling up, while in adventure games it’s typically tied to finding a special item, like the Zelda heart containers.
  • RPGs have a party, adventure games don’t.
  • RPGs usually have a magic system or something like it (though not all characters can use it equally); adventure games typically don’t.
  • In RPGs, enemies are invisible until the battle starts; in adventure games, they’re out there for everybody to see.
  • In RPGs, battles are on a special screen, with most of the action happening by commands selected from menus; in adventure games, battles are on the main screen, and you control the character’s actions directly with the same controls as you use to move around.
  • I think inventories are probably normally handled in a more anal manner in RPGs.

Now, obviously not all of these are aspects tightly linked. Though, I suppose, they must reinforce each other for them to have remained coupled like this. It would be interesting to see a game design pattern language that explained these relationships; can we come up with some reasons? I suppose that multiple party members and magic go together, because magic gives a way for the party members to be differentiated from each other. And multiple party members also go with having a special battle screen with commands on it: otherwise, it would be too hard to control all the characters.

But that doesn’t explain why, in RPGs, the wandering monsters are traditionally invisible. And, indeed, in Paper Mario these aspects are severed: there’s still a special battle screen with special commands, but you see the enemies in front of you while wandering around, and can avoid them if you choose. Which is, I think, a good thing: for example, when revisiting areas later in the game, the monsters are too trivial for fighting them to be very rewarding (either intellectually or in game-play terms), so it’s nice if you can avoid them. Or if you’re in a mood for exploring instead of fighting, it’s good to be able to avoid monsters instead of having them distract you. (I’m still scarred from the ridiculously frequent random battles in Skies of Arcadia: sometimes I wouldn’t even be able to remind myself of what I was looking for when last attacked before another battle would start.)

I suspose the visible monsters are the only item in the other list where Paper Mario picks the adventure game choice instead of the RPG choice, but it makes untraditional choices (that don’t fit into either convention) in several other areas. For one thing, normally when levelling up, the experience point gap grows as you advance between levels. In Paper Mario, however, there are always 100 experience points between levels, and the same monster gives you fewer experience points as you get stronger. This works because the party members aren’t symmetric: you only level up Mario via experience points, while the other characters advance via a separate mechanism. (Which involves looking for certain items, like the way you “level up” in an adventure game.)

The character differentiation also happens differently than in normal RPGs: each companion has one special thing that it can do (give information, send a shell out, blow, hide you, etc.), and while these affect battles (in fact, each special thing turns into multiple special moves in battles), they can also be used in the overworld, to let you get items, get to previously inaccessible areas. This is actually one of my pet peeves in RPGs: you have this magic system, but while it has a big effect on battles, it really is only used outside of battles to heal you. Wouldn’t it be more interesting if you could use, say, a fire spell to burn your surroundings, instead of just burn your enemies? The only other RPGs that I know of that let you use your magic in the overworld are the excellent Golden Sun and its sequel. This makes Zelda-style puzzles possible in an RPG, and can be a lot of fun. In fact, now that I think about it, the connections between characters in Paper Mario and special items in Zelda are obvious: Koops is similar to the hookshot, Bobbery is a lot like the bomb bag.

The way you gain abilities via leveling up is also much more open. When you gain a level, you can chose what to increase: your hit points, your magic points, or your “badge points”. These latter allow you to equip more badges, which give you new attacks, or change your abilities (e.g. decrease the damage you take, increase the damage you do, etc.). So you can personalize your character to suit your playing style, both by what you chose to power up and which badges you equip. (Liesl and I took very different tacks here – for more than half the game, I think I upgraded badge points exclusively, and I chose badge points that changed my characteristics while Liesl chose badges that gave her more different attacks.) Also, the numbers involved are much smaller: in traditional RPGs, you’ll have hundreds of hit points and attacks will do tens of points of damage, while in Paper Mario you’ll have tens of hit points, and a badge that will decrease your damage taken by one point makes a big difference.

I certainly won’t propose this badge system as the ultimate in RPG leveling up systems, but it is a nice change of place, and I hope that future RPGs will continue to play around with flexible leveling up systems. (I had hoped that Final Fantasy X would have a similarly flexible system, but you really didn’t have a lot of choices when traveling along its sphere grid (or whatever it’s called) to level up.)

Enough for today; I’ll finish the discussion later this week.

truffles

December 4th, 2004

Have I extolled the virtues of Bittersweet, by Alice Medrich, here yet? I guess not. It’s a wonderful chocolate cookbook that I’ve been working through off and on; very good recipes, and many of them aren’t very difficult. Today, for example, I decided to make her “Truffles Au Cocolat” again, for the third time; since I’ve gotten recipe requests for it before, I figured I might as well put it in the blog. So here it is!


Truffles Au Cocolat

1 lb. bittersweet or semisweet chocolate (50-62 percent), coarsely chopped
10 Tbsp (1 1/4 sticks) unsalted butter, cut into small pieces
2 large egg yolks, at room temperature
1/2 cup boiling water or freshly brewed espresso
1/2 cup unsweetened cocoa powder

Line the bottom and sides of an 8-inch square pan with tinfoil.

Melt the chocolate and butter together. Combine the egg yolks and water/espresso; mix with a spatula, scraping the bowl to prevent the eggs from scrambling. Then mix that into the chocolate, stirring gently until completely blended and smooth. Pour the mixture through a fine-mesh strainer into the pan, and spread evenly. Cover and refrigerate until firm (at least 2 hours).

Remove pan from fridge; use liner to transfer the sheet of chocolate to a cutting board. Allow it to soften until you can cut it without cracking, about 30 minutes if it is very hard. Invert the sheet and peel off the liner. Put the cocoa powder in a bowl. Cut the chocolate sheet into 1-inch or smaller squares; toss them in the cocoal powder.

Store tightly covered in fridge (up to 2 weeks; up to 3 months in freezer). Let warm up for about 20 minutes before serving.


I’ve simplified the recipe a bit; in particular, she wants you to heat the egg mixture in a double-boiler (she actually recommends an improvised double-boiler, but never mind that) until they reach 160 degrees on an instant-read thermometer. (This is presumably to kill bacteria.) The thing is, just adding the boiling water already brings the mixture up to that temperature, so that step seems not very useful to me. Also, she tells you how to modify the recipe if you’re using higher-percentage chocolate (she tells you how to do that for all the recipes in the book – it’s one of the things I like about it, since it gives the recipes a more experimental feel). When you press the mixture through the strainer, make sure you scrape off the bottom of the strainer. (It’s not clear to me whether the strainer has any role other than to strain out scrambled eggs, for what that’s worth.)

If you’re looking for good chocolate, by the way, Scharffen Berger does a good job. I recommend their factory tour the next time you’re in Berkeley, too.