OdeToCode IC Logo

SQL Server 2005 : Reduces Carpal Tunnel Syndrome Too!!

Friday, May 21, 2004 by scott

I came across an MS slide deck recently touting business intelligence improvements in Yukon via Duncan Lamb. Check out slide 22 – it measures the tedious mouse-clicking festival I experienced today designing a cube to analyze hospital profitability (or lack thereof).

To build the Sales and Warehouse cubes in the sample Foodmart database using SQL 2000 requires 115 wizards and 1,321 mouse clicks.

Building the same cubes in Yukon requires 7 mouse clicks.

Honestly, I dread the cube editor in Analysis Services 2000. All hail Yukon!!

The Lab Experiment

Thursday, May 20, 2004 by scott

The Windows Template Library (WTL) first appeared in the Platform SDK in 1999 I believe, and many Windows programmers latched on to WTL as a lightweight and aesthetic alternative to MFC for building GUIs with C++.

About 4 years ago I was at an after hours conference event where someone asked Tony Goodhew about WTL. Tony was, I believe, a PM for VC++ at the time and the response surprised me. WTL, he said, was “an experiment that escaped from the lab” – something to that effect. He then continued to tell everyone not to use WTL. Not in the “use at your own risk this is unsupported” sense but in a “do not use this because I find it very irritating, and it will be destroyed…” sense.

I’m sure there is a story behind his comments, but even after a couple beers it wasn’t forthcoming. In any case, WTL is the second chunk of Microsoft code to reach SourceForge, where presumably it is now safe from Tony.

Tony’s other irritation that evening was the Remote Object Proxy Engine –ROPE. ROPE was part of the unsupported SOAP toolkit version 1. SOAP on a ROPE sounded cute, but didn’t exactly project a professional image. ROPE didn’t make it to V2. I had fond versions of the early toolkit, because I managed to get a client’s J2EE environment working with my company’s COM+ components pretty quickly, even though we both had early toolkits from Microsoft and Apache which did not implement all of the SOAP encoding specifications.

Come to think of it – I wonder if the person who came up with the name for ROPE also came up with the name for SOAPSUDS. If I remember correctly, Don Box declared ROPE flawed, and now SOAPSUDS dead.

Test-Driven Prose (TDP)

Tuesday, May 18, 2004 by scott

When I work on an article, or a newsgroup answer, I often find myself writing little bits of code to tinker with the framework. Sometimes I just want to try out a scenario before I write up a theory as fact. Other times I just want to see what happens in edge cases through observation instead of digging into a spec or decompile code with Reflector. I’ve found this is a good way to clarify grey areas of documentation.

Many times these little code snippets live inside a project in a temp directory with the name of ConsoleApplication9 or something along those lines, and they eventually end up in the recycle bin. Then tonight it finally hit me on the head with a thud – I should use NUnit, and formalize these snippets into something useful - an ongoing work of tests and experiments.

Now, whenever a new version of the framework arrives, be it a major release or a maintenance / bug fix release, I can execute the tests and see what has changed or been fixed.

I can see a potential benefit for authors who will want to update a work for future versions of the framework. By codifying a book’s descriptions of framework behavior into unit tests, an author can spend less time reading the “What’s new” section of the framework documentation. When combined with unit tests for all the sample code, the turnaround time for revision could be much quicker, which makes both author and editor happy people.

In this community of bright people, I’m sure someone has already thought of this. Maybe there is already a book out about TDP and I just don’t know about it.

Speaking of books, I’ve also been eyeing the book ‘TDD in Microsoft .NET’ as a potential purchase. Steve Eichert has a positive review, and I’m wondering what Marcie Robillard thinks of the book. All of my TDD knowledge has been built from conference and magazine material, so it would be nice to have a more comprehensive and detailed source of information.

Improving .NET Application Performance and Scalability

Monday, May 17, 2004 by otcnews
Expert guidance provided for improving the performance of managed code, ASP.NET, Enterprise Services, Web services, remoting, ADO.NET, XML, and SQL Server. Read the guide online or download the PDF.

Long Race for Longhorn

Sunday, May 16, 2004 by scott

It is the third Saturday in May, in Maryland, and that spells Preakness with a capital P. 100,000 people descend into north west Baltimore. Many of them will end up in the infield for an endurance test of drinking, dancing, betting, gawking, passing out from sun stroke, and all sorts of debauchery.

I enjoy an occasional trip to the track. I never win very much, or loose very much, because I bet pretty conservatively. I determined years ago that betting on horses is not my forte. I look at an evening at the track as an evening of entertainment, more expensive than a trip to the movies – but not if I can win just a couple races. I like to stand outside near the track where I can actually see the dirt fly off the hooves.

The hard part about watching outside is I find it difficult to keep track of the horses. I used to try and stay focused on the horse who could give me the best financial outcome, but by the time they reach the backstretch, I’ve lost sight of the horse. I’m trying to listen to the monotone announcer but it always sounds like “blah blah blah your horse blah blah blah”.

So I’ve decided it is more fun to watch the people around me. As the race gets further along, people become more excited. Some of them clap, some of them stomp, some of them “talk” to the horse. They start to yell and jump and make all sorts of rehearsed gyrations intended to bring good luck. My favorites are the people who have an imaginary whip.

I don’t return my attention to the horses until I can see them well down the backstretch. The horses are beautiful at a night race when their coats are gleaming in the lights and dirt is flying everywhere. I can usually pick out my horse for the last 10 seconds and root him on with a few well timed leg slaps.

Longhorn reminds me of the horse races. I don’t know when this horse will cross the finish line. There are many people who want the product to hurry up, and many people who want the product to go out to pasture. The press tries to create controversy and scandal with all sorts of speculations. At the races, when I can't see what the horse is doing, I start watching what the people around me are doing. With Longhorn, that means putting together little applications.

It is fun for me to see what interesting software people are building with Longhorn. There is the Squarified Treemaps app, the NNTP reader, the Calculator, the Virtual Pet, the TranslateIt!, and I took a crack at it myself with the VSS Label Diff (a real yawner in comparison). By release time I’m sure we will all be in a frenzy.

Anyway, congratulations to Smarty Jones, winner of the 2004 Preakness. If you were my horse, I would have named you Starman Jones - like the Heinlein novel, but at 3 – 5 odds I still would never have bet on you.

Office 2010

Friday, May 14, 2004 by scott

When Beth came to the office door I knew the news wouldn’t be good. High energy and optimism combined to give Beth a cheerful personality, but the look on her face didn’t bode well for the project schedule.

“Well, I’m back from legal,” Beth said. “We have some work cut out for us”.

“What did they say about the latest build?” I asked.

“Big problems with the File commands,” she said, “we have to cut the Import command completely”.

“What?” I asked, dismayed.

“Yep, last year’s ‘SCO versus Corel’ ruling used wording in DMCA III to prevent an application from opening file types registered to another application. It gets worse, though, we will need to cut ‘Save As Web Page’ too.”

“What?” I said, incredulously.

Beth studied a long list of notes on her tablet. “Yep, submarine patents again - small company in Dog Lick, Kentucky has all lossless and lossy picture formats locked up. Until we license some more algorithms we can only render images using 4 bit color bitmaps, but what’s really going to hurt the schedule is the hold up on ‘Send As Attachment’.

“Well,” I said, “Steve and Bill are meeting with President Sheen next week to see if someone can amend CAN SPAM 2009 for us”.

“I hope Charlie can push some senators around,” Beth replied. “The list of approved email clients has been really thin. The ‘Share Over WiFi’ feature has no chance though, and healthcare industry representatives are saying no copies will be deployed unless we allow them a hook into the ‘Open’ command”.

“They can’t do that”, I exclaimed.

“Well, according to the latest HIPPA bill in 2008, healthcare workers need to read, print, and sign an audit form before opening any document which could potentially contain information about a current, past, or possibly future patient, unless the person is standing in the same room with three forms of identification and a notarized release form. Even veterinarians have to be careful now. We have no choice with the current legislation.”

“So what can we have on the File menu?” I asked. “Exit?”

“As long as we RTM before ‘The New Improved PATRIOT Act,” said Beth. “If not, we will need to add the new stealth activity upload.”

“Not a chance of releasing with these setbacks,” I muttered.

”I didn’t even have time to get into the Edit menu with the lawyers,” Beth continued. “I’m sure last month's Supreme Court ruling on the Revised Database and Collections of Information Misappropriation Act is going to kill the ‘Paste’ command”.

“This is stupid!” I blurted. “Applications don’t copy data, people do!”

“Welcome to software design in 2010,” Beth said, then smiled, picked up her tablet, and strode from the room. I sighed heavily, and whirled my chair around. I opened my bottom desk drawer, and pulled out my bar review notes. “No innovation without litigation,” I thought to myself. Those good old days are gone.

Double Check Locking In The News Again

Thursday, May 13, 2004 by scott

Once upon a time, Chris Brumme posted about shortcomings in the memory model of the ECMA specification for the CLR. Not necessarily shortcomings from a runtime performance point of view, but shortcomings from a programmer productivity point of view. In the post he discussed why double check locking requires some attention to detail. Specifically, the following code snippet may not be as thread safe as it first appears.

if (a == null)
{
  lock(obj)
  {
    if (a == null) a = new A();
  }
}

There are interesting comments in response to the post, and eventually Jon Skeet devoted a page to singleton construction. Jon avoids the double check locking issue altogether by using a static field initializer in a nested type. The approach Jon promotes works very well except in cases where you do not know the singleton type to construct at compile time. For example, the type of singleton to construct may be an object derived from an abstract base class in a provider / pluggable architecture and the application reads the type to construct from a config file.

If you can’t use a static field initializer, but still want safe, lazy instantiation, then it seems to me that Brad Adam’s post about using the static MemoryBarrier method of the System.Threading.Thread class is the direction to go, for a couple reasons.

To me, the volatile keyword carries specific overtones. I still think of programming with memory mapped IO when I see the volatile keyword. Volatile variables are completely unsafe for caching. Imagine having a byte in memory hooked up to a thermometer laying on your desk. Not even a single CPU machine knows when the memory location may update with a new temperature value – you have to read it from main memory every time. Volatile has an unfortunate connotation for a singleton reference, which after construction isn’t going to change.

Secondly, the use of Thread.MemoryBarrier explicitly calls out what needs to happen for the code to be thread safe. For people who stumble across the code in the future, they will not need to think of the side effects of a volatile variable when Thread.MemoryBarrier is in place.

Not only do we have maintainable code showing programmer intent, there is a performance bonus too. That being said, if this code was not part of a singleton, and other methods were involved, I'd prefer volatile.