Archive for September, 2004

Objective Caml

Tuesday, September 28th, 2004

As I mentioned previously, I’ve been spending a great deal of time with Objective Caml (OCaml) recently.

Why do I like it?
* Interactive use (like Lisp, Perl, & Python) via the bytecode interpreter (ocaml).
* Compilable to assembly language for a variety of processors (including recent support for Amd64) via the optimizing compiler (ocamlopt).
* Type Inferencing provides the type safety of a language that requires a type definition for each variable (like C#, C++, Pascal, etc.) without (usually) having to declare them manually. So you get the conciseness of languages like Python or PHP without the worries of possible type errors at runtime.
* Pattern Matching is like a case statement with nitrous and supercharger bolted on. See the tutorial below for examples of the neat things you can do with it.

What don’t I like?
* OCaml is so strict about type safety & so focused on performance that there are separate operators for integers and floating point numbers. While I understand the motivation, in practice it really does get in the way when working with numbers (although usually not for other types).
* Getting the command line tools to work correctly for complicated builds (at least under Windows) can be painful.
* There are many fewer libraries available for OCaml than for Python, Perl, or .NET. (However, there is good support for OpenGL under OCaml. Check out LablGL).

Learning OCaml, for C, C , Perl and Java programmers is a great tutorial to get started with. The most pleasant way I’ve found to use OCaml interactively is under emacs with the Tuareg mode. It does very nice syntax coloring and allows the sending of expressions from the editor to the OCaml toplevel one phrase at a time, which is great for interactive development.

Memory Profiling in .NET

Tuesday, September 28th, 2004

A .NET project I work with has recently run into issues with the application slowing down machines when the application has been running for days. After a fair amount of head-scratching, it turns out that checking to see if a class that you’re instantiating implements IDisposable (and then disposing it) can be very important. I knew it was important, but it’s also the sort of thing that can easily get overlooked during crunch time on a project. In fact, it’s so crucial that I’m surprised exceptions aren’t thrown when a program ends that hasn’t properly disposed of disposable objects.

To make a long story short, the Icon class in Windows Forms is one of those classes, and we were creating a great deal of Icons instances. It turns out there are more classes than I’d suspected in .NET that need to be disposed of manually.

Scitech’s .Net Memory Profiler made the process of finding all this out much easier. If you’re a .NET developer (and especially if your application is distributed to end users), I highly recommend picking up a copy. At $99 it’s a steal. It’s already saved the project I’m working on several times that, just counting the hours I would have put in tracking all this down manually.

Welcome to the new site!

Sunday, September 26th, 2004

Welcome! I’ve finally moved from my old weblog to my own domain. I’ve been wanting to start a bliki for a while now but hadn’t found the right software and haven’t had time to write my own from scratch.

Last week I discovered Mark Ghosh’s excellent work integrating ErfurtWiki with WordPress, which, while not a bliki per se, is a pretty good compromise. Wordpress has all the features of modern weblog software while ErfurtWiki allows the easy creation of pages outside the weblog for things like Tachy.

Installation was surprisingly straightforward & I now have a system up and running I’m comfortable with. About the only real annoyance is that the wiki pages use wiki markup, whereas the wordpress entries use HTML, but that’s not too big of a deal. I also wonder if some readers might get confused since the wiki pages and the wordpress pages have the same visual style (although the wiki pages don’t have the weblog sidebar).

Speaking of blogging, I’ve become fascinated with Artificial Life & 3D simulations over the last few months, and have been spending a great deal of time building a foundation for further research into both areas using Objective Caml and OpenGL. More on that soon…