Scott Hanselman

My TWO .NET Rocks shows are up on MSDN now

March 8, '04 Comments [1] Posted in ASP.NET
Sponsored By

I totally forgot that MSDN is hosting the .NET Rocks shows for download!

Not only can you listen to my second show from last month (thanks Rory and Carl!) but you can also checkout my first attempt from October 2003!

  • Show #2: Carl and Rory talk with Scott Hanselman about ASP.NET, declarative programming, client-side validation, caching, perf testing, blogging trends, and more. [MSDN]
  • Show #1: Scott and Carl chat about .NET, C#, Reflection, Regular Expressions, Freeware, Code Sharing, Config Files, Sockets, Multi-Threaded programming, and a laundry list of Scott's favorite utilities that you just have to check out. [MSDN]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

More on My Lasik and the Windows 98 Machine that Zapped Me

March 8, '04 Comments [7] Posted in Musings
Sponsored By

My LASIK posts have been ridiculously popular, considering this is a .NET and Programming Blog.  That being said, there were a few blogs that mentioned my surgery and I thought it would be useful for me spend some time in Photoshop and explain to you EXACTLY what I saw, and EXACTLY what I see now.

Here's before, this is -9.25 diopters (roughly 20/1600 for me) and what I saw without glasses for ~20 years.  I adjusted this photo in Photoshop to show represent what I saw before as accurately as possible.

Here's after.  I'm now at LEAST 20/20 (I'll be officially measured this Friday, one month after my operation.  I suspect I'll be 20/15.  Just a hunch.

I adjusted this after picture to show you exactly what I see now.  Note the slight “motion” blur over the lights.  Note the darkness of the background and the bright contrast of the foreground.  

Not to bad for a Windows 98 machine.  One thing to note also.  While it's totally reasonable to worry about this operation, and most folks are concerned that they might never seen well again, I thought it was a reasonable risk.  It IS VERY possible to have side-effects that will result in a loss of best corrected vision.  There's about a 0.04 percent chance using my doctor's stats.  The problem with stats that compare success with failure is that someone has to fail.  I feel really bad for folks that are in that 0.04 percent bucket - having surgery is inherently dangerous. 

That said, I'm happy with the result - more every day - and I will enjoy the next 10 years of vision...before I have to get bi-focals!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

UEX = User Education and Generating <devdoc>

March 5, '04 Comments [4] Posted in NUnit | NCover | Nant | XML
Sponsored By

I was poking around in the Authorization and Profile Application Block and noticed what nice documentation it has.  I'm a HUGE fan of NDoc, and we build a great deal of documentation with it during the automated build process. (The goal: NAnt -> NUnit -> NCover -> NDoc)

Lots of folks know the basics about XML Documentation in C# but usually only take it this far:

   /// <summary>
   /// The entry point for the application.
   /// </summary>
   /// <param name="args"> A list of command line arguments</param>
   public static int Main(String[] args)
   {
       return 0;
   }

However there's a lot more cool stuff/tags beyond summary and param that can be done with XML Documentation.  Also adding LOTS of rich documentation to your source code can make the files unruly and end up containing more prose then code. 

So, you can instead add your documentaiton like this:

   /// <include file="doc\Main.uex" path='docs/doc[@for="MyNamespace.Main"]/*'></include>
   public static int Main(String[] args)
   {
       return 0;
   }

and then you'd have a file called Main.uex in your doc directory:

<docs>
   
<doc for="MyNamespace.Main">
        <summary>
            <para>Get the whatever from the <paramref name="whateverElse"/> for the <paramref name="whatever"/>.</para>
        </summary>
        <param name="whateverElse">
            <para>The section to retrieve the whatever.</para>
        </param>
        <param name="whatever">
            <para>The whatever to retrieve.</para>
        </param>
        <returns>
            <para>The <see cref="SomeClassName"/> for the given name.</para>
        </returns>
        <exception cref="SomeException">
            <para>An error occurred while performing the operation.</para>
        </exception>
        <remarks>
            <para>Here is some text about something.
</para>
            Here is the config section in the configuration file:
            <code>
            ...
            &lt;section name="mySection" type="MyConfigHandler,MyAssembly,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" /&gt;
            ...
            </code>
            Here is the code that do something.
            <code> 
                using System;
                class MyNamespace {
                private String whatever;
                }
            </code>
        </remarks>
    </doc>
</docs>

Another interesting thing is the <devdoc> tag, which is apparently to indicate documentation that originates from the developer and not the documentation team.   

I think I'll be a lot more likely to include rich documentation for Frameworks we design if I have more room to add code samples and remarks.  Very cool.  You can find lots of great example of this kind of file in the newer Application Blocks, or the Rotor Source Code.  I recommend the former. 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Code Complete

March 4, '04 Comments [2] Posted in Programming
Sponsored By

Congratuations to all involved.  We await this stepping stone with bated breath.

We declared Code Complete on WSE 2.0 just over a week ago. This is one of the major milestones on the road to shipping the product and states that we have finished all the feature work for the product.  [herveyw's blog]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Cargo-cult programming

March 4, '04 Comments [2] Posted in XML | Web Services | Movies | Africa | Bugs
Sponsored By

Some great reminders to folks about cargo-cult programming by Eric Lippert.  This concept was taught to me in college, I think in a CST115 class.   Boy is it the truth.   Sometimes programmers try to make excuses for not understanding the how - "I don't need to understand SOAP, I'm not a plumber."  Well, I'm not a professional plumber either, but I do own a copy of the Consumer Reports "How to fix anything in your house."  Does that make me a plumber?  Hardly.  Just a guy who knows that water flows through pipes.  If not, I'm just an amazed townie who thanks the magical water gods when I get hot and cold running water upstairs. 

During the Second World War, the Americans set up airstrips on various tiny islands in the Pacific.  After the war was over and the Americans went home, the natives did a perfectly sensible thing -- they dressed themselves up as ground traffic controllers and waved those sticks around.  They mistook cause and effect -- they assumed that the guys waving the sticks were the ones making the planes full of supplies appear, and that if only they could get it right, they could pull the same trick.  From our perspective, we know that it's the other way around -- the guys with the sticks are there because the planes need them to land.  No planes, no guys. 

The cargo cultists had the unimportant surface elements right, but did not see enough of the whole picture to succeed. They understood the form but not the content.  There are lots of cargo cult programmers -- programmers who understand what the code does, but not how it does it.  Therefore, they cannot make meaningful changes to the program.  They tend to proceed by making random changes, testing, and changing again until they manage to come up with something that works. 

Read the three-part (and counting) series here: Part 1 Part 2 Part 3  [Brain.Save()]

All this talk about cargo-cults and Mort/Elvis/Einstein reminds me of the Programming by Coincidence stories.

Do you ever watch old black-and-white war movies? The weary soldier advances cautiously out of the brush. There's a clearing ahead: are there any land mines, or is it safe to cross? There aren't any indications that it's a minefield---no signs, barbed wire, or craters. The soldier pokes the ground ahead of him with his bayonet and winces, expecting an explosion. There isn't one. So he proceeds painstakingly through the field for a while, prodding and poking as he goes. Eventually, convinced that the field is safe, he straightens up and marches proudly forward, only to be blown to pieces.

The soldier's initial probes for mines revealed nothing, but this was merely lucky. He was led to a false conclusion---with disastrous results. [The Pragmatic Programmers]

Being a Mort or an Einstein isn't about VB.NET vs. C#.  It isn't even about VB6 programmers without CS degrees.  It's about caring how code works.  Not just for caring's sake (although it helps) but because it makes you a better, more well rounded, and ultimately effective programmer.  So, here's MY cargo-cult-programming-by-coincidence story:

My sister in law immigrated here from Zimbabwe.  She's a teacher, in her thirties, but had never driven.  So, we took the Prius over to the parking lot and practiced for days.  We finally got to parallel parking, and she just wasn't getting it.  It just didn't make sense to her.  So I said, "imagine how the front tires turn left and right when you turn the steering wheel." 

"The front?" she said.  "What difference does it make?"  Turns out she didn't realize that the front tires were the ones that turned.  She'd imagined ALL FOUR tires turning left and right when the car turns.  I insisted that, no, on cars, it's just the front wheels that turn.  She didn't believe me until she got OUT of the car, and watched me parallel park.  She was utterly amazed that the back tires stayed straight and followed the front ones. 

"You didn't know this?" I asked.  She said "I never gave it any thought.  I assumed they all turned, and never asked the question again." 

Certainly this assumption became a problem when trying to 'debug' the process of parallel parking. 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.