Monday, June 27, 2011

Microsoft Moles!

This is a very cool project from Microsoft Research:

I'm able to use this to "fake" or "mock" sealed classes inside of the ASP.NET runtime.

For example:

        public void WhenCannotInterpretSdnUserKeyAsIntegerThenMustRedirectToGlobalErrorPageWithProperMessage()
            // Arrange
            var cookies = new HttpCookieCollection { new HttpCookie(SdnUserKeyCookieName, "Gibberish") };
            var context = new MHttpContext();
            var request = new MHttpRequest();
            var response = new MHttpResponse();
            var redirectWasCalled = false;
            var redirectedToLocation = string.Empty;
            var responseEnded = false;
            response.RedirectStringBoolean = (string location, bool endResponse) =>
                redirectWasCalled = true;
                redirectedToLocation = location;
                responseEnded = endResponse;
            MHttpContext.CurrentGet = () => context;
            context.RequestGet = () => request;
            context.ResponseGet = () => response;
            request.CookiesGet = () => cookies;

            // Act

            // Assert
            Assert.AreEqual("/Error.aspx", redirectedToLocation, true);

How cool is that? The moles are implemented as "detours" and replace components of the runtime when configured to do so.

This is great stuff.

Thursday, June 23, 2011

From 15 Minute Stand Ups to Standing Work Stations : How to Start a Trend

As many people involved with the various agile development practices know, one of the common practices is a brief "Daily Stand Up" meeting to discuss project progress, priority changes, and impediments.

When I joined my most recent team, the Epi-X program at CDC, I wanted to try a different kind of Stand Up. This time, I raised my monitors and my keyboard and I began standing for a large portion of the day to do my work. I don't claim any medical expertise, despite working at CDC, so don't take my counsel on this as anything scientific.

All I can say is that there have been some studies written about in popular articles that seem to indicate constant sitting is detrimental to long-term health, including increased risks of obesity and heart disease. I should also say other studies say there are health risks with constant standing as well!

So, for me, it is not that I stand at my workstation all day long. I am in various sit-down meetings and discussions, and have to walk to different areas to speak with people. And, I do lower my monitor and sit from time to time as well.

I'll continue this post later, but in the past week two people in my office have followed suit! So far, we just use boxes to prop up our equipment, but I'm strongly considering investing in a genuine table-top adjustable desk from

One coworker that adopted this practice also bought himself a foot mat. I have been wearing sandals or occasionally kneeling on my chair.

Remember: Stay agile, not fragile.