Article about MVC, Unit Testing, and WPF

January 27, 2008

I just spent all day writing and publishing an article about using MVC to create modular and unit test-friendly WPF applications. It is based on the demo app I showed at the WPF Bootcamp. Here is the link, in case you are interested in tackling this monster of an article:



My presentation at the WPF Bootcamp

January 23, 2008

I just finished speaking at Microsoft’s WPF Bootcamp in Redmond, WA. My topic was how to design, implement, and unit test WPF applications. I focused on using the Model View Controller pattern, as well as how to write unit tests for the Model and Controller. In about a month or so, a video recording of the entire WPF Bootcamp will be put on the Web. When that happens, I’ll let you know.

The presentation went very well and many people in the audience asked if I could get the demo app source code to them as soon as possible. Instead of waiting for the bootcamp’s material to be released, I decided to host it here on my blog. You can download both the PowerPoint slides and the entire demo app (which requires Visual Studio 2008) here: WPF Bootcamp Presentation (2008)

NOTE: You need to change the download’s file extension from .DOC to .ZIP and then decompress it. This is a workaround for a limitation imposed by WordPress.

Thanks to everyone in the audience who asked those interesting and important questions. That really added to my material. 🙂

I have met many of the WPF biggies while out here. I enjoyed lunch with Rob Relyea and Dr. WPF while discussing the future of WPF, and right now I’m sitting next to Karsten Januszewski and Jaime Rodriguez! It’s great to finally meet the people whose blogs have shaped my thinking about WPF, and whose forum posts have shown me the framework in such great detail.

By the way, I had no idea how popular Mole is becoming! Holy smokes! It turns out that Mole is making big waves at Microsoft. I love knowing that our hard work and dedication has had such a profound and positive impact on the .NET world! 😀

The Rock Star Hack of 2008

January 20, 2008

Hacks are usually the result of working around a bug or artificial limitation in some library against which you are coding, but have no ability to modify. I typically try to brush my hacks and workarounds under the rug, hoping no one will ever see them. But today I am proud to announce a hack I came up with. This is, in my opinion, one of the few hacks worth its weight in digital gold.

Karl Shifflett and I were talking on the phone yesterday. He mentioned that he has received a lot of support e-mails on where people are confused about how to open Mole. Several people have tried to view an object in Mole that wasn’t “moleable,” meaning that the Mole.Visualizer.dll assembly is not decorated with an instance of the DebuggerVisualizer attribute where the target type is the type of object (or ancestor type) they want to molenate. In other words, people have been trying to open Mole on a business object they created, but Visual Studio does not list Mole as an available visualizer for that object.

Team Mole has known about this issue for a long time. The crux of the matter is that Visual Studio will not allow us to apply the DebuggerVisualizer attribute to Mole and specify that it works for any object that descends from System.Object. Visual Studio does not want to show Mole as an available visualizer for any type of object, but that is exactly what we want it to do. Yesterday I figured out a simple way to work around this artificial limitation imposed by Visual Studio. Karl has since dubbed it “The Rock Star Hack of 2008” since my nickname is Rock Star (more on that here).

Visual Studio has no qualms with allowing us to specify that Mole can be used to visualize a System.WeakReference object. Since WeakReference is basically just a thin wrapper around any object, we use WeakReference as a Trojan horse to smuggle any object past the Visual Studio sentries and into Mole. Once Mole gets a hold of the WeakReference we wrapped around the object that we actually want to visualize, it unwraps the object and displays it in the UI, throwing away the WeakReference in the process. Keep in mind that we are only using WeakReference as a container to smuggle any object into Mole, we are not using that class for its intended and documented purpose.

So that’s all well and good, but it would be a real nuisance if you had to stop your debugging session just to edit your code and create these WeakReferences for Mole, wouldn’t it? That’s where the Watch window enters the picture. You can create a WeakReference in the Watch window, and pass the object to visualize into its constructor. Here’s an example of how I used this feature to open Mole on Podder‘s main data model class instance:

The Rock Star Hack of 2008 in action

Once the WeakReference has been created in the Watch window, I can simply click on the magnifying glass icon to open Mole. Bear in mind that this code is executing in the application’s data model assembly, which has no UI controls or anything else that you typically use to open Mole. Before this hack was invented, using Mole in this situation was impossible. How cool is that?!

Karl posted this video on YouTube showing how to use The Rock Star Hack of 2008:

You will need to get the new drop of Mole to perform the hack. The new drop also supports molenating Windows Workflow Foundation apps! Here is the link:

Listen to the Polymorphic Podcast about Mole

January 15, 2008

I am extremely happy to announce that the Polymorphic Podcast has recently published an episode where Craig Shoemaker and I discuss the Mole debugger visualizer!  In the interview I explained a lot of background information about Mole’s development and how it works.  If you are interested, feel free to check it out here:

I highly recommend you listen to the Mole podcast episode using the Podder podcast player… 😉

Mole v4.1 released

January 15, 2008

Mole has been updated with some cool new features and minor bug fixes:

  • Added the ability to export an object’s properties and fields to an XML file. That file can later be imported to allow for element comparisons.
  • Fixed the image processing code so that it handles exceptions raised only after editing certain properties/fields of a control.
  • Added tooltips that display fully qualified type names to the TreeViews, breadcrumb items,  and the property grid’s Type column.
  • Added a “Show Namespaces” option to have the TreeViews, breadcrumb items, and the property grid’s Type column show the fully qualified type names.
  • The “Show Attached Properties” CheckBox is now hidden when not viewing WPF applications.

The source code and binaries associated with the article have been updated as well.

If you would like to quickly get up to speed on using Mole, be sure to watch the tutorial videos on YouTube.

Have a great day!

Podder now has a visual designer

January 10, 2008

I am thrilled to announce that Grant Hinkson, visual designer extraordinaire, has agreed to create a new skin for Podder!  I have the utmost respect for Grant’s talents as a visual designer, his imaginative use of visual effects, and his expertise in WPF.  I can’t wait to see how good Podder will look once he is finished with it.

I thought it was a long shot when I asked Grant if he would be interested in working on my side project, because I know he is a very busy person, but he was just as excited as I am about working on Podder.  It is great working with passionate people!  I feel that the Podder project has now gone from being cool to phenomenally cool.

Here is a little background info on Grant, in case you are curious:

  • Director of Visual Design at Infragistics
  • Created the WPF tool called Pistachio
  • Wrote part of the “Silverlight 1.0” book, published by Wrox
  • Created the Fireworks to XAML Exporter
  • Active in the Fireworks community
    • Articles on Adobe Devnet
    • Did Fireworks session at Adobe Max
  • Fellow Bach fanatic 😉

Thanks for agreeing to help make Podder, Grant.  I can’t wait to see what you come  up with!

Meeting Sacha Barber

January 9, 2008

If you are interested in cutting edge .NET technology you probably have heard of Sacha Barber. His tour de force on the CodeProject is impressive, to say the least. He is a Microsoft MVP, a CodeProject MVP, and a .NET 3.5 expert. My kind of guy! 😀

I had the pleasure of meeting Sacha recently, while his girlfriend and he were on vacation in New York City. Actually, we had such a great time hanging out that we got together again before they returned to England. Sacha is not only a .NET rock star, but also a very nice and fun guy to hang out with. His girlfriend, Sarah, is top notch, too.

Here are some pictures of two .NET alpha geeks (and a lovely English lady) hanging out together, drinking, eating, and enjoying life. Click on the pictures to view them at full size.

Sacha, Sarah, and me enjoying yummy mojitos at Bluesmoke

Sacha, Sarah, and Josh



Sacha and me enjoying mojitos at Bluesmoke

Sacha and Josh (at Bluesmoke)

Sacha and me drinking beer at Heartland Brewery

Sacha and Josh (at Heartland Brewery)

Me and Sacha eagerly awaiting the chance to eat more ribs, at Bluesmoke

Josh and Sacha (eating ribs at Bluesmoke)

Bach by popular demand (again)

January 9, 2008

In my previous post I took a little break from WPF to post a recording of me playing a Bach composition on the piano. I’m having too much fun to stop!  I made another recording, this time it’s the Prelude to Bach’s first keyboard partita, in B-flat major.  For some reason, toward the end of this recording it sounds a little strange, like someone passed it through a wah-wah pedal.  Oh well…enjoy!

Prelude in B-flat major (as played by Josh)

Bach by popular demand

January 9, 2008

I meet a lot of people who are into WPF.  It’s funny how many of them are interested in the fact that I play Johann Sebastian Bach‘s keyboard music on the piano.  Bach has been an obsession of mine since I was a little kid.  I’ve been playing the piano since I was five years old, and have been in love with Bach’s music since around then.

Quite a few people have asked me to send them a recording of me playing a Bach piece.  I have a Yamaha Clavinova CLP 240, which is a fantastic digital grand piano.  Recently I realized that I can create semi-decent recordings of me playing the piano and then save them as MP3 files.  So I decided to satisfy the curiosity of all those people who, for whatever strange reason, want to hear me play some Bach.

I wish I had more time to practice the piano, but being obsessed with WPF kinda gets in the way.  The performance is pretty good, but there are definitely things about it I would like to improve.  Unfortunately I’m not sophisticated enough at this stuff to figure out how to edit the audio file. 😉  Alright, enough excuses for my shortcomings.  Here is a recording of me playing the Rondeaux from Bach’s second keyboard partita, in C minor: Rondeaux in C minor (as played by Josh)


The Mole tutorial video

January 7, 2008

Karl made a nice and short introductory video to using our Mole for Visual Studio debugger visualizer. If you want to quickly learn the ropes of using our free tool, check it out here: