tools

August 11, 2005 tools

What should I do w/ the metadata?

Imagine I’ve got some “metadata” that describes some functionality of my system, e.g. the command line parameters to a tool:

<args description=“Two wrongs don’t make a right, but three lefts do”>
  <arg name=“lefts” description=“Number of left turns” type=“int” default=4″ />
  <arg name=“attitude” description=“Driver attitude” required=“true” type=“string” />
</args>

Once I have this “metadata” in place, should I a) use it to generate a class at compile-time that implements the command line parsing, or should I b) use it to drive a command-line parsing framework at run-time?

If I do a), generate the code, the result might look like this:

class Args {
  public void Parse(string[] args) {…}
  public string Usage { get {…} }
  public int Lefts { get {…} set {…} }
  public string Attitude { get {…} set {…} }
}

I’ve got better perf, but I have to generate the code in some way and .NET doesn’t come with any built-in tools to do that (no, I don’t count ASP.NET or XSLT as good codegen tools). Plus, the command-line args are now baked in and require a re-compile to change and who cares about perf to parse the command line? Finally, I’m much more likely to have most of the work done in a base class, e.g.

class Args : ArgsBase {
  public void Parse(string[] args) { return base.Parse(args, …); }
  public string Usage { get {…} }
  public int Lefts { get {…} set {…} }
  public string Attitude { get {…} set {…} }
}

In my experience, most of the work of code-gen is generating the smallest possible bit of code to provide a nice wrapper around a base class that does most of the work in a very interpretive manner.

If I do b), have a run-time interpretter of the “metadata,” I’ve got to build a command-line argument interpreter, but, as I’ve said, you almost always have that anyway. However, I also give up a develop-time wrapper aka “Intellicrack” which will be pried from my cold, dead fingers.

What do you guys do?

August 3, 2005 tools

WinFX Beta 1 Online SDK Docs

July 22, 2005 tools

Cool Avalon Default Style Trick

Karsten shows a cool trick for pulling out the default style of an Avalon lookless control. This is super useful if you want to replace an existing control's look, but you don't want to have to start from scratch.
July 12, 2005 tools

Eric Sink: The Game is Afoot

I don’t know if Eric understands the ISV industry or not, but certainly seems to. Luckily, I’m on a real product team now, so I get to try to channel Eric into my work.

Eric’s latest writing is The Game is Afoot, in which he describes various games and then draws lessons from them for ISVs. It’s fabulous. He concludes by apologizing for the length and then teasing us with the analogies he left off. It wasn’t too long, Eric! I wanted more! (I also want your blog to have comments, but that’s another thing entirely…)

I think now I understand the public outcry when I suggested that I might cut down on the material in the Windows Forms 2.0 book…

July 12, 2005 tools

Looking forward to the Portland Code Camp, 7/23-24

The session list for the Portland Code Camp, July 23-24, has just been posted. I’m especially looking forward to the following:

  • .NET Windows Forms Tips & Tricks
  • Forensic Development
  • Implementing Creature AI
  • Introduction to Inform
  • Introduction to Python
  • Introduction to Ruby
  • Ruby on Rails
  • MonoRail - ASP.NET on Rails
  • Web Unit Testing with Ruby and Watir

That’s only if my wife doesn’t have my working on the house (we’re prepping it for sale). Of course, I don’t know if she’ll understand that I’ve volunteered to give my own session: “Some Cool Avalon Stuff”…

July 5, 2005 tools

Register for COM Interop and VS05b2

I was helping a colleague work through a .NET COM interop issue. He’d found my article on the topic (“Hosting Windows Forms Controls in COM Control Containers”), but couldn’t get it to work. He’d set the Register for COM Interop setting and adding the Guid attribute to his .NET type, but nothing was registered at build-time.

The problem was that, unlike VS03, the wizard-generated AssemblyInfo.cs has the assembly-wide ComVisible attribute set to “false” which causes regasm (the command-line version of what VS is doing to register your .NET assembly with COM at build-time) to skip the registration of all of the .NET types in your assembly, defeating the purpose of the Register for COM Interop option pretty thoroughly.

The trick, of course, is to set ComVisible to “true”.

July 5, 2005 tools

Grid: The King of Avalon Layout

The Grid is by far the most useful, powerful and general purpose layout tool in Avalon. As a demonstration of that, Amir Khella, a Microsoft PM on an Avalon-related team, plays with the Grid to build a fish eye effect, duplicating the behavior of the scaling OSX toolbar with 8 lines of C# code. He then goes on to implement the trick in 2D to scale images as you mouse around. Cool stuff.
June 28, 2005 tools

Avalon and ASP.NET, Together At Last

Scott Guthrie says:

“What we’ve set out to do is to make it dramatically easier for anyone to build AJAX-style web applications that deliver rich, interactive, and personalized experiences. Developers should be able to build these applications without great expertise in client scripting; they should be able to integrate their browser UI seamlessly with the rest of their applications; and they should be able to develop and debug these applications with ease.

“For this work, we’ve been working on a new project on our team, codenamed ‘Atlas.’ Our goal is to produce a developer preview release on top of ASP.NET 2.0 for the PDC this September, and then have a website where we can keep updating the core bits, publishing samples, and building an active community around it.

Then Scott says:

“We see Atlas as the best way to write a whole new generation of richer, more interactive, more personalized experiences in browser applications.  Avalon is the next generation presentation model for Microsoft, and will let you build the richest user experiences on the Windows platform. Avalon will deliver phenomenal graphical experiences that use the latest in media integration and hardware acceleration. And Avalon will also let you provide persistent, immersive experiences that go beyond the browser.

“Of course, when you’re building Avalon applications, you can reuse the programming model investments you make today with ASP.NET and Atlas. For example, the ASP.Net Building Block Services and Client Building Block Services will also be accessible from any Avalon client. This model gives you a smooth path to the next generation of applications.”

And then I say:

“Cool!”


← Newer Entries Older Entries →