# Tuesday, 27 June 2006

I took Steve’s comment to heart, and got rid of the two places I had been “forced” to use the CodeSnippetExpression.  It took a few minutes thought, and a minor refactoring, but I’ll sleep that much better at night. 

Vive le DOM!

Tuesday, 27 June 2006 13:10:37 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, 26 June 2006

A few days back, Jeff commented that he wasn’t convinced about the value of putting an object model on top of what should be simple string generation.  His example was using XmlTextWriter instead of just building an XML snippet using string.Format. 

I got similar feedback internally last week when I walked through some of my recent CodeDOM code.  I was asked why I would write

CodeExpression append = new CodeMethodInvokeExpression(sb,"Append", new CodePrimitiveExpression(delim1));

instead of

CodeExpression append = new CodeSnippetExpression(“sb.Append(delim1)”);

It’s a perfectly reasonable questions.  I’m using the CodeDOM’s object model, but the reality is since we’re an all-C# shop, I’m never going to output my CodeDOM-generated code as VB.NET or J#.  So I could just as easily using a StringBuilder, and a bunch of string.Format calls to write C# code and compile it using the CodeDOM’s C# compiler.  It certainly would be simpler. 

The same is true (as Jeff points out) for XML.  It’s much easier to write XML using string.Format, or a StringBuilder. 

If nothing else, I personally find that using the object-based interface makes me think harder about the structure I’m creating.  It’s not really much less error-prone that writing the code (or XML) by hand, it just provides a different way to screw up.  What it does do is force you to think at a higher level of abstraction, about the structure of the thing you are creating rather than the implementation.  You may never need to output binary XML instead of text, but using XmlTextWriter brings you face to face with the nauances of the structure of the document you’re creating.  Writing a CDATA section isn’t the same as writing an element node.  And it shouldn’t be.  Using the object interface makes those distinctions more obvious to the coder. 

However, it’s definitely a tradeoff.  You have to put up with a lot more complexity, and more limitations.  There are a buch of contructs that would be much easier to write in straight C# than to express them in CodeDOM.  It’s easy to write a lock{} construct in C#, but much more complex to create the necessary try/catch and monitor object using the CodeDOM. 

I was, in fact, forced to resort to the CodeSnippetExpression in one place, where nothing but a terniary operator would do.  I still feel guilty.  :-)  Maybe it just comes down to personal preference, but I’d rather deal with the structure than the syntax even if it means I have to write more complicated code.

Monday, 26 June 2006 14:05:19 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  | 

Aboutt 4 months ago I moved into a brand new (town)house.  It’s been great, particularly since our last house was generating more maintenance opportunities that we could handle.  The new place is 3 stories, and there’s a deck off the back of the second floor over the driveway.  Staining/finishing said deck is left as an excercise for the homeowner, and yesterday I finally got around to it.  At first I didn’t want to tackle it due to the everpresent rain, and lately it’s just been a matter of finding the time.  And I really hate ladders. 

Anyway, I had the time, the materials, and no rain.  Unfortunately, it was around 100° yesterday.  It’s a small deck, but nonetheless 4 hours of huffing paint fumes on my hands and knees left me a bit nackered.  And today I’m finding out how unbendy I’ve become (i.e. crippled today). 

This whole getting older thing really blows. 

Monday, 26 June 2006 13:14:20 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  | 
# Thursday, 22 June 2006

I’m a huge fan or runtime code generation.  I think it solves a lot of common problems in modern applications.  However, the .NET implementation of runtime code gen, a.k.a. the CodeDOM, is viciously difficult to learn and use.  I think that’s holding many people back from implementing good solutions using runtime codegen. 

For example, it takes all this

CodeConditionStatement ifArrayNotNull = new CodeConditionStatement(

    new CodeBinaryOperatorExpression(propertyRef,

    CodeBinaryOperatorType.IdentityInequality,

    new CodePrimitiveExpression(null))

    );

CodeMethodInvokeExpression convertExpr = new CodeMethodInvokeExpression(

    new CodeTypeReferenceExpression(typeof(Convert)),"ToBase64String",

    new CodeExpression[] { new CodeCastExpression(typeof(byte[]),propertyRef)}

    );

ifArrayNotNull.TrueStatements.Add(convertExpr);

to make this

if(myObject.Property != null)

{

    Convert.ToBase64String(myObject.Property);

}

Not only is it a lot more code using the CodeDOM, but it’s certainly not the kind of code that you can just pick up and understand. 

There must be an easier way.  Refly helps a bunch, but last time I tried it I found it to be incomplete.  It’s certainly a step in the right direction.  It’s certainly a model that’s much easier to understand.  I wonder if, in the end, it’s too limiting?  There may be a good reason for the complexity of the CodeDOM.  Or there may not be.

Thursday, 22 June 2006 16:32:32 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  | 

Next Wednesday evening, I’ll be talking about the wonders of source code control at this month’s PADNUG meeting.  If you’re currently using SCC, you might get some tips for making better use of it.  If you aren’t, you’ll find out why you should be, even if you work alone.  I’ll be focusing on the role of SCC in agile development and continuous integration.  I’ll also talk about some of the many version control systems available, and which one(s) may be right for your environment (as well as which ones you really shouln’t be using:  you know who you are…). 

And there’s pizza!

Thursday, 22 June 2006 15:33:23 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
I hope not.  But since it seems to otherwise be a good recording, I fear it’s so.  Check out Hanselminutes 21, wherein Scott interivews Jeff Atwood and I about the relative merits of Subversion vs. Team System.  Taking the show on the road was a great idea, and all the segments came out very well.  I’m amazed that he and Carl were able to clean up the audio to the point that you hardly hear the other 7–8000 people in the room with us.
Home | TechEd | Work
Thursday, 22 June 2006 15:28:15 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  | 
# Monday, 19 June 2006

On Saturday, Vikki and I participated in this year’s NW Emergency Response Team Rodeo, and had a blast!  This event is for ERT groups from NW Oregen/ SW Washington to meet each other and practice their skills.  We got assigned to mixed-jurisdictional teams, each team about 6–8 people, including one radio operator.  Each team then rotated through 10 stations where we got to practice triage, cribbing and extrication, first aid, victim transport, fire supression, SAR, etc.  Big fun. 

This year it was hosted at TVF&R’s training facility, so we got to put our car fires, search a 5 story building, look for victims in the dark, and extricate victims from under actual rubble.  Best of all, we had instructors from fire departments all over the area who were coaching and teaching us (most of them on their own time, thanks guys!).  Disneyland for safety nerds!

We’re actually running another rodeo this year, in September, so if you’re on a local CERT team, come out and play.  If you aren’t, go get trained

Monday, 19 June 2006 11:33:51 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 

TechEd is over, and I’m starting to get back into being home.  I think I’m still on Boston time, so I was up at 5:00 this morning, but other than that it’s coming together.

I think my two biggest takeaways from TechEd, as compared to the last time I went (2003) are that there were way more women at TechEd (good) and the inconsiderate cell phone use was at an all time high (bad). 

Other key learnings:

  • the food was terrible
  • the TLC concept was much cooler than the “cabanas” last time
  • it’s very easy to write good tooling in VS 2005 + GAT + DSL
  • WCF and WF rock

I had a great time meeting new people, and it was very entertaining standing in the shadow of the great man. :-)

TechEd | Work
Monday, 19 June 2006 11:26:46 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, 15 June 2006

Slowing down now.  Me, not TechEd.  Very long days starting to take their toll...

That aside, I've seen some very groovy stuff over the last day or two.  WF as the controller in an MVC architecture, using rule-based activities in WF, WCF talking to an Oracle system over standards based web services (with security, reliable messaging, MTOM, et al).  Shy Coen did a good chalk talk yesterday on publish and subscribe patterns using WCF which gave me some good ideas.  I'm looking forward to seeing more about the Service Factory tomorrow morning.  Meeting lots of very smart people. 

I realize my sentences are getting shorter and shorter, and the nouns will probably start dropping out next.  Attendee party tonight.  Nothing I like better than 12,000 drunk nerds all in one place.  With batting cages.  I'll take pictures. :-)

On a completly different note, look to see some major changes to this blog in the next week or so...

Thursday, 15 June 2006 08:37:10 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, 13 June 2006
Scott and I are now done with our TechEd session, and all was well.  Whewww!  It was down to the wire, and I think we finished our slides about an hour before we went on stage, but we pulled it out in the end.  I think it went pretty well, but we'll see what the evaluations have to say about it tomorrow. :-)
Now I'm hanging out at the birds of a feather gathering ('cause, ya know, free beer) and watching Stuart strolling around wearhing a giant parrot on his head.  Not something you see every day.  Unless you work with Stuart.  I'm looking forward to actually attending some sessions tomorrow, since I won't be worrying about how badly I'm going to suck.
I saw a couple of good talks yesterday, my favorite of which was Don Smith and Jason Hogg talking about web services security.  If you care at all about securing web services, check out their patterns & practices book.  It completely kicks the llama's @ss.  They presented an early version of their Web Service Factory, which is a guidance automation toolkit package for building and securing web services, either in Indigo or in WSE 3.0.  Very groovy stuff. 
I also saw a good one this morning by Pravin Indurkar on building state machines with WF.  They've really thought hard about this, and I really think that it's a viable solution not only for building state machines, but for using said state machines for driving UIs.  Pravin had a very compelling UI demo that was mainly driven by the workflow instance itself.  Excellent.
More tomorrow after I've had some time to absorb some new content.

TechEd | Work
Tuesday, 13 June 2006 17:03:00 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  | 
# Monday, 12 June 2006
I'm here in Boston (finally).  I haven't done it in a while, so I'd nearly forgotten how much fun it isn't to fly cross-country.  2 hour delay in Denver (just because), followed by the usual hassles of airports, shuttles, etc.
Anyway, after only 12 short hours, I was here.  I hustled over to the convention center to make it in time for the keynote, only to be pretty disappointed and leave early.  The keynote (at least the bit I staid for) was very buzzword oriented.  I understood all the words coming out of Ozzie's mouth individually, but strung together they didn't make any sense.  So, I opted for dinner and a beer instead.
I ran into Scott in the lobby, and ended up hanging out with an ever growing crowd of clever people in a blur of beer and chicken fingers.  The highlight for me was talking Ruby with the (quite) clever and (highly) articulate John Lam.  There's apparently a lot about my programming environment I don't consider very deeply. :-)
The first sessions are about to start, so I'm off to see if I can learn something. 

TechEd | Work
Monday, 12 June 2006 06:00:02 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |