Microsoft Enterprise Library 5.0 and Microsoft Unity 2.0 Beta 1 released

There are a whole bunch of changes in the just released Microsoft Enterprise Library 5.0 Beta 1 and in Microsoft Unity 2.0 Beta 1. I have been using these libraries for years and have greatly been looking forward to this new release.

The list of changes for Enterprise Library is very long indeed and going into specific changes here on this page seems redundant when you can go check it out for your self.

Regarding Unity it seems it is not required any more to reference the ObjectBuilder assembly when using Unity; any functionality previously required from this assembly are now included in the Unity assembly. Nice.

Cheers,

Magnus

ReSharper 5.0 (Beta) for Visual Studio 2010

Being a C#:er the one and only refactoring tool for me is ReSharper by JetBrains. In fact I would go so far as to disclose that I held off on upgrading to Visual Studio 2010 because the early builds of this great refactoring tool were not very useful and didn’t really help me.

With the 5.0 (Beta) version for VS 2010 the world has become much more stable and my brand new machine has only VS 2010 installed. No old and moldy VS 2008 for me!

I’d like to draw attention to a new feature in ReSharper 5.0 which is actually a feature I have requested. Sure more people might have requested this very feature but I for one did.

The feature is that you get intellisence for undeclared items like this:

Resharper

Thank you JetBrainbs for this! ;~)

It’s a pretty sweet feature. However, unfortunately, it only covers local scope for now. I’d like to have the same feature only fully fleshed out for class scope and even perhaps for global (or any) scope.

But what about the Alt + Enter feature that creates a new local variable, property, field etc.? We already have this feature, don’t we? Well not exactly. I get tired of the fact that I cannot decide where this declaration should be. ReSharper always inserts these new declarations at the line immediately above or some such – often in the “wrong” place. I usually go Alt + Enter, mark the line above, Ctrl + x, move to the new spot, Ctrl + v. That’s a lot of extra key strokes. With this feature you can move to where you want your declaration exactly and start typing for intellisence. A lot better don’t you think?

Do you think this is a good feature? Go check out the original feature request “Intellisense should suggest undeclared items” at ReSharper and add a comment if you, like me, want this feature to grow to become complete.

Cheers,

M.

What’s new in Visual Studio 2010 and .NET Framework 4.0?

Here it is the definite resource: New Features in .NET Framework 4 and Visual Studio 2010, (Beta 2). That is if you have 8 hours to kill. Might certainly be worth the time. I’m looking forward to it.

Cheers,

Magnus

Windows Azure Tools and SDK 1.1 (February 2010)

There is a new release for Windows Azure today with a refresh of the Windows Azure SDK (1.1, February 2010) and the Windows Azure Visual Studio Tools (1.1, February 2010). If you want code samples, as usual, go to Windows Azure Code Samples on Code Gallery.

UPDATE: So as not to mislead; If you are using Visual Studio 2010 only on your system the Windows Azure Tools for Visual Studio requires Microsoft Visual Studio 2010 RC which is not yet released. But with Visual Studio 2008 you are safe.

The biggest news in there is that you can now begin to use the new Windows Azure Drive (aka. xDrive) which allows a Windows Azure application to mount and use a file stored in Windows Azure Blog Storage as a standard external hard drive. This enables drive intensive server applications to be portable to Windows Azure.

The release also includes OS Version Support which allows a Windows Azure application to choose the appropriate Guest OS to run on in the cloud.

Hurry up and download – you want the latest tools don’t ya? ;~)

Cheers,

M.

P.S. Thanks Per for pointing out this release for me today.

Introducing the new Jayway

Guess this post is a bit of a commercial spot. Excuse me, but this is also a good way to inform my readers that I am now working under a different brand than I have until now. I used to work for a brand called Dotway. There I had my email, there I had my home. Most of you know me as Magnus from Dotway. This has now changed. My email will be @jayway.com instead of @dotway.se.

Dotway was just one brand in our group of small specialized companies. We also had a Leadway, Testway, Realway and a Jayway. The last being our first and oldest brand. This has caused some confusion and extra work among our clients and contacts; - “Which -way are you again?” ;~) Therefore…

Five ways become one - Jayway
Dotway, Jayway, Realway, Leadway and Testway gather under one name.

We now simply call ourselves Jayway. As one company we become more visible and distinct and we will be able to offer our clients an even stronger package. We are the same passionate experts working with the same intense commitment and we will continue to deliver the same first class services. You will meet the same people with the same courage and pride. And a new fish!

Meet “Jay”:

Fish

Like Jayway, the blowfish is unique. It swims fearlessly in unknown waters and is a rare delicacy – the best of its kind. On the surface Jayway’s offer might not be rare, but the way we solve your problems is unique. Effectively, passionate and uncomplicated.

Here is our new logo including the name:

Jayway

And here is a pdf explaining the same thing as this page does:

Cheers,

Magnus

TechDays 2010 – Happenings and appearances

Soon it it is time for Microsoft TechDays Sweden 2010. Lots of things will happen, lots of great presentations will take place. I will be there!

Note: I am now on ½ time parental leave for a while – which is great. Weird but great. This, among other things, greatly impacts how often and what I have time to blog. (In case you were wondering why my blogging is a bit slow these days.

Regarding TechDays there are several things I’d like to call out:

My blog is blinged with the official speaker badge:

techdays2010[1]

This of course means I am a speaker at TechDays. This year I have the honor of serving along side a good friend and colleague Peter von Lochow and our target is to explain what storing data in the cloud is all about if you ask Microsoft. Our session is on Windows Azure Storage and SQL Azure and is titled “Effective and infinite storage in the Cloud”.

But my buck does not stop here with that honorable task… noooo… ;~)

I am also a panel member on the big Cloud Panel that will take place at TechDays. In fact I initiated the panel together with Liselotte Isaksson at Microsoft so I am very happy that Microsoft Sweden has followed through and realized this idea. The panel will discuss the Cloud in all aspects. We will have true cloud, developer, IT and management experience on stage and we will take audience questions. Chaired by the Dude himself: Robert Folkesson from Microsoft Sweden.

Geek Award

Also I have to mention the Geek Award which will be handed out at the Event:

banner-geekawards 

I have the honor of being one of the judges on the panel along with my good friends Joachim Nässlander, Mikael Nyström, Robert Folkesson and Danwei Tran.

TechDays 2010 in Örebro, Sweden is gonna ROCK! Be there or be a Mac user!

Cheers,

M.

Technorati Tags: ,

Azure Contrib @ CodePlex updated to the November CTP

The enhanced (intelligent) Windows Azure Project template @ AzureContrib.codeplex.com is now updated to run on Windows Azure Tools for Microsoft Visual Studio (November 2009).

There is a new piece of code for managing logging (tracing) with the new Microsoft.WindowsAzure.Diagnostics functionality. The Microsoft.WindowsAzure.ServiceRuntime has been updated to reflect the recent changes to the Azure runtime including support for the new Windows Azure Role Lifecycle.

The new Microsoft.WindowsAzure.StorageClient release is pending but that takes a bit of more work. The goal @ AzureContrib where Cloud Storage is concerned is to enable so called Persistence Ignorance (PI). The PI thing is about being blissfully ignorant of exactly where my data is stored and how it is stored. Instead of depending on a specific storage technology those who adhere to PI instead depend on an abstraction of storage that gives us the abstract functions we require; such as save, load, select etc. This part of AzureContrib will be reviewed later (soonish).

The enabling extensibility technique

We use Managed Extensibility Framework MEF to enable extensibility and inversion of control features in AzureContrib.

Azure Service Runtime news

There are some news to the Windows Azure RunTime. Just briefly:

Lifecycle

There is now a lifecycle for an instance of an Azure Role (both web role and worker role) that has three steps: OnStart, Run and OnStop. Only in Run state will the role receive incoming traffic from the Fabric Controller.

Three types of work

This means we have redone the way our “work” is used. We had the notion of “IWork” that would run in normal operation and also an “IOneTimeWork” that ran during startup – once.

Now instead we have that which is called an “IWorkITem” that has a “WorkItemType” that can be OnStart, Run or OnStop.

Introducing Azure Diagnostics

Debugging the cloud is a BIG task for any Azure application. This is done through tracing which works really nice. Trace is stored in a Windows Azure Storage Account off the actual role instance that did the tracing. Pretty nice if you ask me!

The problem with statics

However if tracing is this important I feel, as a responsible developer, that the only reasonable thing would be to be able to use tests to validate that specific trace messages actually are written. The problem then becomes that System.Diagnostics.Trace is a static class.

How do you easily write tests for accessing static methods?

The answer is: It is not easy to do.

Enter the ITrace abstraction:

ITrace – the abstraction of static Trace

We have abstracted out the Trace class and it’s static methods from our code in AzureContrib. This is done by creating an ITrace contract. This contract is in turn implemented by a wrapper class that wraps around the calls to the static Trace class.

Using this abstraction of Trace we can now write tests that actually verify the existence of specific trace messages after certain conditions in code have happened. This way we can trace errors, warnings what have you and attain the ability to write tests that can verify our trace messages.

Windows Azure After Work event in Stockholm on December 2nd

Finally I’d like to mention that if you are in Sweden near Stockholm on the 2nd of December Microsoft and the Microsoft Extended Experts Team, where I am a member, is arranging and hosting a Windows Azure After Work event. Dotway (through my colleague Peter von Lochow and me) are co-hosting and will be demoing and leading discussions on Azure technology and opportunities. Anyone can meet up in central Stockholm after work where we will discuss Windows Azure to our hearts content:

clip_image001_thumb[1]
http://www.facebook.com/event.php?eid=177384451401&ref=mf

Hope to see you there!

And we, Peter and me, hope that this new drop of AzureContrib will be useful as inspiration to someone out there aiming their development efforts to the clouds.

Cheers,

M.

Digg This

Tech Ed Europe 09 round up

Last week I spent at Tech-Ed Europe. Here is my round up and follow up on audience questions etc.

Note: Why do I always loose that note – the one that says NEVER start an epic blog post… ;~) well… here it is… an epic post. Sort of. At least in length and diversity of subject matter.

It was very very eventful and quite exhausting to be a first time as a speaker at Tech Ed. Consequently (naturally/obviously?) I overreached a little. But – oh – did I have fun! It was friggin’ awesome and I want more!

The Role of the Software Architect Caring and Communicating X 2

My first session was an interactive on “The Role of the Software Architect Caring and Communicating”. This topic turned out to be hugely popular at the event even though it is a “soft” topic. I believe the popularity of talking about the Software Architect Role is due to the fact that this role – when given in an official capacity to a developer – is one of the very few real career moves for a developer in many firms. Sure we can go all day talking about weather or not the Software Architect really is a real role that should exist or if the team shouldn’t be the ones in charge of Architecture. But let’s not go there. Suffice to say that the formal role of Software Architect does exist in many companies today and that awesome responsibility usually also comes with real benefits or at least with a bit of respect and rank.

I’m the kind of guy who likes to deliver my material in a way that makes people think and get involved. In so doing I sometimes like to challenge sensitive topics. In this session I was bringing up a stereotype, or two actually, in order to prove a point and to invoke a discussion. My example was that of a guy who is 100% techie and has 0% communication skills. The opposite being a 100% communicator that could not change batteries in a remote control if she was given a map. Did you note that I said he and she here? Well in my talk I accidently chose a man for the techie and a woman for the communicator. Funny thing was that my example woman is a good friend of mine whom I know as one of the best techies in any room. I never gave the gender implication any real afterthought. In fact to add insult to injury I make a crack about it. I got a pretty good laugh from the room. One person, however, took offence and left the room. I never caught who that was but he (or she) immediately went out and wrote a “death and fire” review on me being sexist. There were a 100 people in the room. There were quite a few women there. No-one took offence that I pulled up the stereotype of the man being unable to communicate because he was a technician. I am not making any excuses; the person who had the feeling of sexism is perfectly entitled to his (or hers) opinion. I do feel perhaps that if everyone else understood that Í was speaking about stereotypes then perhaps (dare I say it) that person was being a bit over-sensitive? If you can’t event speak about the stereotypes how will you be able to ever do anything about them?

Still I would like to offer an apology to the person who took offence in my session because I certainly did not mean that I subscribe to sexist and improper judgments of people.

I did get a bunch of good reviews too. One stood out in particular: http://www.teebot.be/2009/11/teched-09-day3-its-architecture-day.html

This was a great picture you created. Loving it! Yes I did quote Yoda: The opposite of a good UI leads to anger, anger leads to pain and pain leads to suffering. Now Yoda wasn’t talking about UIs but still…

yoda2

Flexible Design

I also did a session on Flexible Design which I’ve been told was too complicated and I did not deliver as clearly as the topic would have required. Sorry about that because the message is important and also the gateway to good maintainable code design. I have gone and commented the code in my session demo for you. It should be possible to follow my train of thought from one to nineteen. My files in the demo are numbered. If you follow the numbers all the way it starts off with a little calculator that has no flexibility, no testability and no maintainability with a lot of dependencies to everything in the book including the kitchen sink. In the end at the number nineteen you would have a piece of code that has VERY much flexibility (testability, maintainability and very few references to other code). The final sample uses both a Dependency Injection container which is abstracted away AND the Managed Extensibility Framework MEF (which is part of .NET Framework 4.0). It is certainly not required to build your code with this extreme amount of flexibility. I do – but I’m very extreme in these respects.

The main gains from this approach are as follows: You are removing references to the Dependency Injection container. Still you are using the DI Containers configuration API for speed and compile time integrity but with a simplified API that keeps the hard reference to the larger API of the DI container. The solution is made easily extensible. The testability is very high. The maintainability also.

Here is the code from my demos: References – which are not included may be found at CodePlex; Common Service Locator, Unity and MEF. The other code will be released soonish at http://commonserviceconfig.codeplex.com

Also I promised to post my Common Service Configurator API on codeplex. NOTE : If this link here is dead I have not published yet… ;~) Right now I’m sending my API out on review to a few friends to make a good strategy of this thing before I release it. Please be patient.

Talk: Building extensible systems in .NET 4.0 and Silverlight

I also did a session on Managed Extensibility Framework MEF. This session went really really well. I am very happy with the fact that I seemed to have gotten my message across and the audience was very satisfied with my overall performance, my knowledge on the subject and the efficiency of delivery. Thank you who attended. It was a pleasure delivering this talk.

Backup fail - Master fail - ohoh - less then 30 minutes to show...

Scary moment folks… In final preparations for this MEF session suddenly I noticed that my backup USB key was broken. Strange I had used it not 30 mins earlier. Now I notice that I have a frozen window in my PC as well… well that’s weird. Instead of killing processes I decide to make sure and reboot. This is what my computer looked like when it stared up:
checkdisklessthan30minsbeforeshow
With a prestigious .NET Framework session at Tech Ed that I was doing to help out a friend and with less than 30 minutes before show I suddenly find myself without a working backup and now without a working master! Slides were available on the computer in my presentation room but I had no demos. They were all on the presumably broken computer and the broken backup USB. Imagine walking into session saying "sorry my computer is not working"... That’s like saying “my dog ate my homework”. Minutes where ticking away and my computer was checking hard drive integrity… Twenty minutes to show... Seventeen minutes... Computer comes up. I log on and start up Power Point and Visual Studio with one of my demos. They work. Now I’m afraid to shut down my machine. I walk through the conference with my computer running under my arm and my luggage rolling behind me including the Aladdin Chocolate I brought to attendees on all my interactive sessions. (Yes really.) Make it passed the escalators and into my room. Hook up the computer. Validate that it’s running. Calming down. Collected. Time is here… I go on. And I deliver. Phnew… That was nerve wrecking.

Next time I’ll have two backups.

Tech Talks

When at Tech Ed why not record a couple of Tech Talks? A Tech Talk is a short interview on some interesting technical topic. I did two

Managed Extensibility Framework extends to Nirvana – 6 min pitch on MEF.

Windows Azure Applications: Bring it on! - Open Source advanced Azure template – 19 min discussion on how to code maintainable and nice Azure applications. This interview relates to http://azurecontrib.codeplex.com and http://cloudstorageapi.codeplex.com.

Speaker Idol Jury

Finally at Tech Ed I was on the Speaker Idol jury for the final round of this years prestigious Speaker Idol competition. The contestants were really good. The competition is to present a technical topic for five minutes. The winner is awarded a session on next years Tech Ed. It was fun to be part of the panel of judges. Hard work - but fun.

Well that’s it for my Tech Ed week. Not really sure what this post added to the greater good? I guess for future documentation and for my references to material attendees were asking for at the event.

Cheers,

M.

Digg This

Do I need to check a params parameter for null?

If I have a method that takes params as input. Do I need to check for null on that set of params ? Well answer is yes if you want to be really sure because there is one way to get a null into the method call.

Note: I am currently working on code that I promised the Tech Ed Berlin audience when I delivered my talk Flexible Design last week. If anyone waiting is reading this – it’s on the way. I just want to make sure i document the sample so that the code may be read from start to finish and that the message is clear enough.

Below is a test class with one test: TestsOnCallingAMethodThatTakesParams(). The test, which is not so much a test as it is an easy way to execute a bit of code for investigative purposes, makes calls to a method that is defined as a params input: TestACallWithParams(params string[] args).

I hadn’t really thought about this before but when I saw a method null checking to see if the “args” parameter was null it got me thinking. Under what conditions could args in this method signature actually be null?

The code below is pretty self explanatory but just to be sure; IF you decide to call a method specifying params for a parameter and you call the method with a null value TestACallWithParams(null) then the parameter value of the args parameter will indeed be null.

Personally I feel that calling a method that defines params with an actual null value is an error on the programmers part. The correct way to call this method is to leave out the parameters altogether TestACallWithParams(). This causes the input to be an empty array which you can use in a foreach statement or what ever you like.

[TestClass]
public class tests
{
    [TestMethod]
    public void TestsOnCallingAMethodThatTakesParams()
    {
        TestACallWithParams();
        TestACallWithParams(null);
        TestACallWithParams((string)null); 
string s = null; TestACallWithParams(s); TestACallWithParams(new string[] { }); TestACallWithParams(null, null); TestACallWithParams("foo", "bar");
TestACallWithParams(new [] { "foo", "bar" } ); } public void TestACallWithParams(params string[] args) { if (args == null) { // Do I really need to check for null here? } /* If you break here and look in the immediate window these are the results from each call above: args {string[0]} args null <- NOTE: The null value here in the call with nust null! args
{string[0]}
[0]: null
           args
           {string[1]}
             [0]: null

           args
           {string[0]}

           args
           {string[2]}
             [0]: null
             [1]: null

           args
           {string[2]}
             [0]: "foo"
             [1]: "bar"

           args
{string[2]}
[0]: "foo"
[1]: "bar"
           */
    }
}

In conclusion

You should not have to check for null on a parameter marked as being params. However if you want to be 100% certain that the user of this method does not make a coding mistake you have to check it.

Cheers,

M.

Technorati Tags: ,
Digg This

At Tech-Ed Europe brains are exploding

Tech-Talks recorded today. One on an Open Source and very much enhanced Windows Azure Project Template and another one that turned out to be a lot more “what is MEF” than I initially anticipated? And at the event at large people are looking focused on learning just as we do at the beginning of a week. I am anticipating less and less strength for focus as the week progresses. So this week I am at Tech-Ed Europe attending as a speaker on the Architecture track. Here is a brief account of the first day so far.

Today anyway, apart from getting a blister walking the HUGE venue, I have had the opportunity to record two Tech-Talks here at Tech-Ed. (A Tech-Talk is a 10-20 long interview video recording that will be published at the Tech-Ed web site.)

My first recording was on the work we have been at Dotway on Azure Contrib to enhance the File->New template in Visual Studio for those who are looking forward to creating new Windows Azure applications. I talked about the fact that we have enhanced the template in three steps:

1) Making the Windows Azure SDK a lot more testable. (Read more here on my original post on how we put some love between Windows Azure and the Managed Extensibility Framework)

NB: Managed Extensibility Framework (MEF) is a new library in .NET Framework 4 that is developed under an open source license on CodePlex: http://mef.codeplex.com

2) We created a Cloud Storage API that we published as open source at http://cloudstorageapi.codeplex.com. This API is an OO API that closely mirrors the Windows Azure Storage REST API. Then we implemented part of it using the Sample Storage Client code shipped with the Windows Azure CTP. The implementation is published, in fact all parts of this work is published as open source, on CodePlex at http://azurecontrib.codeplex.com.

3) Finally we took advantage of MEF in Windows Azure to enable worker roles to be more extensible, intelligent and able to work on many different tasks as easy as implementing one method on a small interface. Using this Template the Azure Worker Role does not become a tangled mess of code or is not just a dumb close loop executing just one type of batch job. Also we have a thing we call the “One Time Work” service which is used to run changes for instance to your Windows Azure Storage environment and ensures your one time actions are run just once and not every time you request a page on your Azure Web Role or run through the loop in your Azure Worker Role.

All in all this enhanced Windows Azure Template is a LOT more powerful and useful as a starter for Your Applications.

My second Tech-Talk Session was just a brief intro to what MEF is and when and where it can, or should, be used. If you know nothing about this take six minutes of your time (as soon as the recording is on line) and get to know the Managed Extensibility Framework better)

(If you happen to read this AT Tech-Ed 2009 please don’t hesitate to contact med in the Technical Learning Center if you have any questions about Extensible software design and architecture, MEF, Azure or anything else you want to hear about. My break out is on Thursday on the topic of Flexible Design and my Interactive Session is scheduled as a repeat session on Wednesday morning and afternoon and it is on the topic of The Role of the Software Architect Caring and Communicating.)

I will post a note when my recordings are on line.

The evening is not over yet. Berlin will have  a HUGE party in the city today due to the “20 jahre mauerfall” – which means 20 years since the Berlin Wall fell.

Cheers,

M.

Digg This
Magnus Mårtensson
Senior Consultant .com
Contact