Archive for March, 2005

NicePlayer 0.91

Tuesday, March 8th, 2005

Jay and I release NicePlayer 0.91 over the weekend. I did a lot of work on DVD playback support and the underlying plugin framework. Indeed, the plugin API has been mostly solidified (except for adding support for returning a nib for custom configuration in the plugin preferences), and there’s a even some sample code posted on the NicePlayer web site to help others create plugins. In fact, for anyone who is looking to create their own DVD player using Apple’s DVD Playback API, they need not look further than the provided sample code, which is basically the code that NicePlayer uses to play DVDs. If all goes as planned, the next release will use VLC to play video: not only will it give a great speed boost to playing back divx files and such, but will also provide a better user interface for VLC users.

The other big new feature is AppleScript support — extremely useful for users of the Saline clicker software. There’s a resize widget, as per Nicholas Riley’s suggestion, and the widgets now smoothly fade out after you’ve moved your mouse off of them. While trying to figure out if we could get normal correct window shadows for NicePlayer (we can’t without faking our own — something which makes the app a lot slower), Jay found the following shadow bug in OSX — the non-focused windows with standard OS X shadows have an artifact in them — a thin line running along the bottom, below where the shadow should have faded out. You can see this if you stack several TextEdit.app windows on top of each other, such that the bottom shadow falls on the white space in the window below it (this makes it easier to see). The line is fairly clearly visible, and I’m surprised I didn’t notice it before Jay pointed it out.

Smalltalk on the JVM

Friday, March 4th, 2005

I ran across a piece of software called St/JVM by Mission Software that allows you to run Smalltalk code on the JVM. This is inherently exciting because not only does it bring some assemblance to the CLI (specifically, the .NET VM) — I can’t think of any inherent reason that the JVM can’t support multiple languages in the same way that the .NET VM does (although other languages are ‘second class’). It makes me wonder how this is implemented though — as I recall there were certain issues with having to modify the .NET VM that Ralph Johnson’s group was working on to get Smalltalk to work on the .NET VM.

Is there some sort of intermediary layer between St/JVM that is written in Java itself, and not simply a compiler that compiles to JVM byte code? St/JVM also claims to support blocks, which leads me to believe that this must be the case — and that St/JVM could potentially be somewhat slow. This is mainly due to fact that activation records in Smalltalk sit in the heap, whereas activation records for most other languages sit on the stack. This is mainly due to the fact that you can create blocks with references to variables in the activation record — the lifetime of the block could live longer than the lifetime of the function, and the existing variables that are referenced in the block must still be valid as long as the block is still exists (this is probably the hardest thing to deal with in implementing blocks in Objective-C, I intend to write more about this in the future). It would seem like St/JVM probably implements activation record objects using a Java abstraction, allowing you to do all of the neat things that Smalltalk does, such as viewing activation records as objects when in the debugger. Unfortunately, there’s no downloadable demo at the moment on the page — it would be interesting to see what the performance is.

BlueJ and Teaching Java

Tuesday, March 1st, 2005

For those of you who haven’t heard of BlueJ, it’s a development environment designed for teaching Java. And it’s really, really shiny. This is really the first development environment I’ve seen for teaching programming that I would actually want to use as a teacher.

You start off designing your your class hierarchy graphically. You can define your inheritance by dragging arrows between classes — in this sense, it teaches some simple UML by the virtue of being able to see things graphically. You can also define abstract classes and interfaces and such. And here comes the kicker: you double click on any one of these class objects to edit the code in the class.

Other things that are neat are things we’ve had in Smalltalk: a code pad window, where you can write arbitrary Java expressions and evaluate them. Also, you can right click on any class in the class diagram and click “new object()” — this will then create a graphical representation of this newly created instance in a small window at the bottom of the IDE, where you can right click on the representation and send messages to it. What I mean by this is that a graphical window pops up asking for the arguments, you type those in and hit OK, and it returns the result, like in Smalltalk.

Even better is the integrated support for JavaDoc. This allows you to learn to use JavaDoc, but even better is the fact that the code view has a drop down box that lets you choose “Interface” where the JavaDoc rendered class documentation is immediately shown! And if that’s not enough, BlueJ has support for Unit testing so that you can learn testing methodology in parallel with Java programming and class documentation.

This is really such an amazing system that it’s worth a download just to play around with it.