Extending WL Writer

So I downloaded the SDK for WL Writer and took a quick look. Basically, there’s two types of extensions you can build:

  • App Launcher – so you can add a “Blog It” button to some other app to remotely launch WL Writer. I assume this is how the WL Toolbar intergration works.
  • Content Source – so you can add some type of custom content to a post. Typical examples would be Technorati tags or Currently Listening To info.

Given that they are trying to support “every blogging service out there”, I’m surprised there’s not a way to build a plugable blogging service. WL Writer only allows you to customize the content of the post via plugins. Customizing the metadata (i.e. categories) is right out. I realize it’s the hip thing to put Technorati tags right in your post content, but Technorati also picks up category information which dasBlog already has great support for. What I’d really like is something that acts like del.icio.us’ new post form, where you can free type in your categories, it highlights words as you type and it shows you a list of all your tags so you can click on them.

One other minor note – WL Writer does a good job for inserting hyperlinks. When you select a word, often the whitespace that follows it is also selected. Some HTML editors will insert the hyperlink over the whole selection – inlcuding the whitespace which makes no sense. WL Writer gets it right and excludes any trailing whitespace from the hyperlink. Cool!

A Few Short Takes

I did say I was going to go a little dark when I took the new job didn’t I? Things have been hectic – my brother’s getting married in just under two weeks and I’m working on getting my part of my new project’s Business Requirements Document (otherwise known as the BRD) done before I leave on vacation. The BRD process is fairly odd for this project – for one, the project team is writing it instead of the business unit. Given that we’re building infrastructure, many of the “business” elements of the BRD are not particularly appropriate. But we’re muddling thru. In a meeting with my boss’s boss’s boss last week, he stressed the need for delivering incremental value. In other words, the need for using an agile process which is cool as far as I’m concerned.

I have a couple of longer posts coming, but here are a few short takes for a Monday morning:

Windows Live Writer

Everyone seems gaga over the new tool, so I downloaded it. Pretty cool. I’m writing this post using it. Typically, I write my posts in FrontPageSharePoint Designer and paste them into the dasBlog web editing interface – I’m pretty particular about the HTML that ends up on my blog. So far, Writer seems up for the job. And I love the Web Layout editing mode. Does have some bugs and missing features. For example, it has spell check, but not background spell check. And as Scott pointed out the category list is totally broken when you have a lot of categories. Writer has an SDK, and one of the examples they suggest building with it is “Tags from tagging services”. I’d like to have a simple text box where I could enter categories as tags, and have it automatically create any categories that aren’t already on my site. I’ve already got a side coding project going, but I’m almost done so maybe I’ll take that up next.

XNA Game Studio

I was researching some Xbox stuff for a customer several months ago and got wind of this plan. I can’t wait to see it running. I recently picked up Frank Luna’sIntro to 3d Game Programming: A Shader Approach based on Dave’s recommendation. I figure most, if not all, the source code will be obsolete in the XNA Framework world, but the concepts are spot on so it’s been a good read.

One aspect of this announcement that I haven’t seen talked about yet is the impact on the mod community. Many games today ship with an SDK – here are examples for Dungeon Siege, Half-Life 2 and Doom 3. Of course, the idea is that modder’s get a popular game and industrial-strength game engine to build on for almost no cost and the game publisher expands the value of their game – any mods require the original game to play. Wouldn’t it be cool if you could mod Halo 3? And combined with Live Anywhere, the possibilities are enormous. I can’t wait to see how this evolves.

New Machine & Vista

For the first time in my nearly 8 year MSFT career, I have a desktop machine. And it’s a nice one – a Dell Precision 690 workstation. 2x dual Xenon CPU, 2x 160GB SCSI Hard Drives, dual link DVI outputs for driving twin widescreen monitors – dual is very big on this machine. Pretty much the only skimpy part of this machine is the RAM – only 2GB. But I’m not running x64 (yet) so that’s not a huge deal (yet).

Of course, such a screaming machine runs the latest Vista build. I’m also running it on my laptop – with Aero Glass even, thanks to this driver. The combo of latest Vista build + latest Office build is pretty sweet.

With new machines and new operating systems, I’ve been spending significant time installing. The Dell box turned out to be a real pain as it only has the SCSI drives which are not standard on the WinXP install disk. I’m dual booting XP/Vista on both machines, but I had to create a custom slipstreamed XP install disk to get my Dell workstation up and running (Vista installed without any extra work). But now I’ve got the baseline install imaged – thanks to BootIt NG which I’ve spoken highly of before – I shouldn’t ever have to do that again.

Is SML Another Unwanted Modeling Language?

Piyush Pant wonders if SML solves a problem that nobody has? He also points out SysML project, which recently got folded into the OMG. Well, that explains why we called it “Service” instead of “System” modeling language.

Now that I work in IT, I can definitely say that SML will eventually solve a problem that I have. Most people agree that operations today is way to dependent on manual processes to scale effectively. Now SML doesn’t solve that issue directly – as Piyush pointed out SML is a meta-modeling specification. However, SML is the foundation for the next generation of operational modeling tools like what we see in Visual Studio Team System for Architects. As I wrote several years ago, VSTS:A solves a very common problem – developers lack of understanding about the deployment environment. Piyush, haven’t you ever had a long weekend going back to the drawing board because the solution you had built was undeployable and you didn’t discover that fact until the operations team attempted to deploy it? If you haven’t, I envy you.

On the surface, I agree with Piyush when he says that “history of software is littered with unsuccessful attempts to impose monolithic modeling constructs”. However, the fact that it keeps happening indicates the problem hasn’t been solved. Wanting to solve a problem and being able to solve a problem are two different things. Furthermore, the history of software is also littered with very successful attempts to raise the level of abstraction by the introduction of new programming languages: C, C++, VB and Ruby are all examples of this. Given that Code is Model, what we have is a history of software littered with some successful and some unsuccessful modeling constructs. I would argue that the successful modeling constructs have taken a bottom up approach – build a language a small abstraction step above something that actually runs and compile down. These unsuccessful modeling constructs (*cough* UML *cough*) take a top down approach – build a language way above anything that actually runs and hope a miracle happens to keep it in sync with the stuff you actually build.

The question is whether SML will be top-down (i.e. a failure) or bottoms-up (i.e. a success). So far, it’s to early to tell, but I have high hopes.

Lang.NET Is Helping Game Developers

Back at POPL 06, Tim Sweeny of Epic Games delivered a talk titled “The Next Mainstream Programming Language: A Game Developer’s Perspective“. I imagine he was a little too busy getting Gears of War out the door to attend the Lang.NET Symposium. Too bad, as there were interesting solutions presented that solved two of the issues Tim identified in his his POPL talk.

One of the issues Tim identified is one of Modularity. Gears of War uses the Unreal Engine 3. In other words, UE3 is a game framework and GoW uses that framework. As you might expect, this framework is exposed as a hierarchy of objects. Tim’s example had “Actor” as the base class in the framework hierarchy, with classes like “Player”, “Enemy” and “InventoryItem” inheriting from “Actor”. Then he had game-specific classes like “Dragon” and “Sword” inheriting from the generic “Enemy” class. The problem is that game developers also need to extend the functionality of the framework’s base classes. That is, they need a game-specific version of “Actor” or “InventoryItem” in addition to the game specific subclasses like “Dragon” and “Sword”. Unfortunately, the current generation of languages don’t support this, so game developers often clone the entire framework, which is error-prone and hard to support.

At Lang.NET, Professor Markus Lumpe demonstrated an implementation of the Classbox concept for .NET. Classbox is essentially a solution to the modularity problem Tim identified. They’ve modified C#’s using syntax to apply to individual classes. When using a class in this fashion, you can add extensions to it like new methods and new fields. I’m not sure the scope of these extensions – whether it’s the file with the using clause or the containing assembly – but it’s key to realize this is a local extension. The original framework isn’t modified at all. Within you assembly, the metadata for the extended classes is re-written to include the new extension. So to use Tim’s example, if you extended the framework’s “Actor” class, it would create a YourGame.Actor class that inherited from the Framework.Actor and contained your extensions. Then it would re-write the inheritance metadata (again, only for your assembly) so classes that inherited from Framework.Actor such as Framework.Enemy and Framework.InventoryItem now inherit from YourGame.Actor.

Now I’m sure there are some nefarious uses of this type of inheritance tree hacking. But there are scenarios such as Tim’s Gaming Framework example where this behavior is exactly what you want. I spoke briefly to Markus and at length with Hua Ming, one of Markus’ grad students, about perhaps having a keyword indicating that a class is “classbox enabled” rather than allowing any class to be classboxed in this way. Looking forward to their future work.

Another issue Tim identified was Reliability. He called this problem “If the compiler doesn’t beep, my program should work”. He showed a very simple method to iterate an index array and transform the associated vertex from a vertex array by a provided matrix. A simple function – four lines of code. Yet, the compiler can’t detect null pointer or out-of-bound array access. Adding code to check those runtime conditions would easily double or triple the length of the function. While modern managed languages (C#/VB/Java) have made great strides in eliminating “random memory overwrites” (via type safety) and “memory leaks” (via garbage collection) they don’t help you with these other types of dynamic failures.

At Lang.NET, Microsoft Researcher Mike Barnett demonstrated Spec#. Spec# is a superset of C# that solves these and other types of dynamic errors. The idea, in Mike’s words, is to better bridge developer intent and code by embedding certain specifications into the code itself. Furthermore, it uses a combination of static and data flow analysis to detect the types of dynamic errors Tim described in his talk. So if you took Tim’s simple transform function and fed it into the Spec# compiler, it would warn you of the possible null pointer dereferences. Furthermore, you can eliminate this warning by specifying the caller never pass you a null pointer. This is simply accomplished by adding an exclamation point to the type declaration. In other words, the vertex array method parameter would be declared “Vertex[]! vertices” to indicate you can’t pass in a null array. With Spec#, you can also specify method pre and post conditions, which can solve the out-of-bound array access issue, as well as object invariants, which can specify the valid states an object instance can be in.

I didn’t see Tim give this presentation, I only saw the slides after the fact. But I get the feeling that one of Tim’s points is that game development is extremely cutting edge, and the issues they’re running into now will be mainstream issues in a few years. Good to see language researchers are already well on their way to solving these issues.

The only thing I worry about is when will these ideas make it into mainstream languages? And will they be extensions to existing languages – i.e. will C# 4.0 and VB 10 include classboxing and specifications – or will they be entirely new languages? How much can you improve a language by adding features until it collapses under it’s own weight?

More on Lang.NET

Jason Bock left me a comment that he’s covering Lang.NET over at his .NET Languages site. His coverage of day one is here. Looking forward to his coverage of day two and three!