-=//mawi.org//=-
 Monday, May 21, 2007

This week was short work-wise, and went by quickly. Last week was hectic and long. Me and my colleague Truls gave a seminar on NHibernate, a little ActiveRecord and some of the new MS OR stuff. Then I spent three days with another consulting company, showing them the ins and outs of NHibernate and sprinkling just a little WCF on the last day. In so doing, I caught myself serving out some code that I have used. Normally, I don't dish out any code here, but this might be useful to some:

 

It's a small WCF test helper that I have used to do explorative testing of WCF and even more so for integrative smoke tests of WCF services.

 

There is a zip attached that contains one vs.net 2005 project with a WCF hello world and one nunit test that runs that service. That test is an integration test, it cranks up the whole WCF machinery. Most of my WCF integration tests (all, in fact) do not test any concurrency issues. They are more simple smoke tests that everything seems to work as expected. What I usually want is to test the machinery but have one instance invoked, so that I can execute some assertions on the results using that instance afterwards.

 

Usually, you will not implement your WCF service as a singleton (although it is one of the instancing modes), for one of several reasons - scalability for example. Using the other instancing modes means that you (by default) do not control construction of your the instance that gets to serve the requests, and thus in a test situation, we do not have a reference to the instance used by WCF. One way around this is to create a custom instance provider. The instance provider in WCF (class implementing IInstanceProvider, the default being a private class in InstanceBehavior, reflect it) is responsible for supplying new service instances. I won't talk about it here, suffice it to say that my SingletonInstanceProvider simply returns one (settable) instance each time, thus making the service a singleton. It is a service behavior that we add to the servicehost description.

 

Why do this? Simply so that I can implement my service using an instancing mode that I want, but still run simple smoke tests on it. It is one solution, there are doubtless many others, if you have a better one, please give me a shout.

 

So, the testhelper or testharness that is enclosed actually does a couple of things. I won't talk about them in detail, this is roughly it:

 

  • Provide a simple way to create and start a service host and get a client to run tests against it.
  • Provide a way for tests to share services, so that the WCF machinery does not need to be restarted.
  • Get the services set up using the SingletonInstanceProvider easily
  • Allow test to access host before it is started to modify/further configure
    ( this is why you see castle in there, the client (a dynamic proxy wrapper) is actually a proxy that opens the service late/JIT )

You use it like so:

 

IMessageOfTheDay client1 = GetClient
   .For<IMessageOfTheDay>()
   .Using(new NetTcpBinding())
   .Running(serviceInstance);

 

This sets up a service host for the IMessageOfTheDay service contract, using the netTcpBinding (optional, default is named pipes since it is the fastest) and running the instance supplied. See the demotest.

 

Comments welcome. Btw, this uses my singleton implementation, I'll make a note of that tomorrow, but it's simple.

 

Questions: Has anyone seen another wcf test harness like this? I usually do all my network integration testing using some thread harness with synchronization between, and did my WCF testing in a similar (not the same) way. This harness simplified things quite a bit.

 

BTW: Most of the code is in one file; TestHelper.cs. It's a bit unwieldly, sorry, but easier to copy - you still need the singleton.cs though. I may update later if I get time.

 

Again, the download is here.

5/21/2007 2:00:04 AM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback
 Sunday, April 29, 2007
(or rather respect and stimulating work...)

While we were in Dijon testing our new system I read most of the last IEEE Computer issue - which I often do not, but reading magazines filled out the cab rides. In it you find this article. Nicholas Carr blogged and a pretty nice discussion followed. I certainly disagree with the conclusion Nick comes up with, and I think that the article is more nuanced but many statements are made without proper underpinning. Regardless, the discussion inspired this pretty funny cartoon, too. One commenter (Tony Healy) drew the parallell to geeks great nerd needs: I think that the need for respect and the awesome feeling of being able to help others is magnified in most geeks. Some thrive on the "I am smart" feeling. Like most, I have transformed mine into, "see, you can do it this way!", after which I often get a "oh, great, thanks!", which gives me a warm, fuzzy feeling inside.

That - and feelings like it - are what I live for. Sure, this can be taken advantage of, and is taken advantage of, I'm sure. But, at the end of the day, as long as I keep getting what I live for... it's pretty much ok. Soon, I will cultivate the business person in me, or something... Right now, I gotta go on doing some demos this lovely sunday afternoon.

4/29/2007 4:37:57 PM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback
 Wednesday, April 25, 2007
<rant>
Being an avid resharper user for several years, I cannot live without it.

As time goes by, I also feel that I cannot live with it.  It seems to me that the quality of the product (which has never been great) is spiraling downward.

So this is a word of warning: Before you get addicted to the features, realize that you will pay a price in bloat and bugginess in the studio, that may or may not be substantial.

In one out of my three current setups it's not that problematic.

In my daytime setup with the latest stable patch, it is crashing the studio several times a day, and the bugs I have mailed them have never been fixed.

Reinstall of my environment is probably the way to go right now, but it is eerie that not much has changed except the resharper updates.

Most people I talk to have similar experiences, turning the thing on and off, like a bad relationship. Bugs and bloat seem to appear often at blogs discussing resharper. What are your experiences?

Is it worth 249? Sure, its a great product. 249 + much of your time? Hmm, I'm starting to loose faith.

</rant>
4/25/2007 2:59:14 PM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback
 Sunday, March 18, 2007

At the latest AgileØresund meeting we had the usual mix of new and old people representing both devs/techleads and project managers. I (again) wanted to talk about team morale. Being a consultant I get to move between company cultures quite often, which allows me to more easily see and experience differences among them. Having worked for some of the larger traditional companies in Sweden, this is a most fascinating aspect. It is fun to reason about how the company culture has been devised and/or emerged, and what the logic behind it is - what must have been the benefits the leaders saw when promoting some values inside the organization? Morale in a team comes both from the context - from "upwards" if you like - and from within the team. A team needs a vision in order to believe in the work they do. If you do not think that the work you do will matter to anyone at all, then you are not likely to invest heavily in the work. From within the team, a breach of morale will spread: If someone looses faith in the project, that may spread and will at the least affect the others.

 

I think there is a junction where these things meet; how we express our faith and passion can become a heuristic that is then expected - a mindless rule that the team has to work overtime at some point, that the team has to do this and that. (Well, blindly following rules is almost never good, nothing new there.) This junction is basically where acting and appearances are more important than actual results. Acting and appearances are naturally very important, but are not directly related to the results.

 

Anyway, Chris mentioned this post from Kathy Sierra (I don't read her blog regularly anymore myself) that talks about the target of passion - company or work. I really see a connection to her post.

Agile | Misc
3/18/2007 8:15:19 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  |  Trackback
 Wednesday, February 28, 2007

There was a project called the Netron project a while  back, that offered a nice graphing library and several related libraries. I used to check the blog regularly, to see progress, and so on. I stopped for a year or more, but not so long ago, I ventured to do so again. I got really suprised, and went to do some checking. Check this adress, you may be surprised to:

 

http://netron.sourceforge.net/

 

Don't read on until you've checked it!

 

Checked it?

 

Were you surprised? I sure was. If you did not bother to check it, the sourceforge project page has been emptied of all contents (don't know if the source was ever hosted there though, here is someone saying that the CVS repos were removed, which would be very odd indeed). The project homepage link instantly redirects you to an ordering page for a graphing product "Go Diagram". Basically, an ordering page on sourceforge! Odd!

 

In summary, Netron was an open source project that did not use a well known license, but the license was a "use anyway you want" type of thing. It appears to be affiliated with this go diagram commercial venture, but there is no indication of how or why. I don't think there is anything wrong about that, per se. These things feel strange to me, though:

  • The redirect from sourceforge to the order page.
  • Not leaving a trace of the OS project - after you have accepted donations to the open source project. Check out the thankyou note to "Axel" at the end of this page.

It looks strange, and not pretty. If I had to call it by the looks of things, someone went commercial with the stuff and (perhaps even as insiduously as being part of some agreement?) removed all content they had control over, everywhere (sourceforge, codeproject articles, etc).

 

Other people have written about this, I wanted to note my own findings here. Do note this posting. There is a resurrection project for the source here, and much of the previously available documentation is hosted here. You can of course browse the archived versions of the homepage, archived codeproject article, and blog. It is strange, isn't it?

(Photo: Tony Richards, Herford)

2/28/2007 9:49:39 PM (Romance Standard Time, UTC+01:00)  #    Comments [1]  |  Trackback
 Thursday, January 04, 2007
ReSharper is the best refactoring tool for Visual Studio (it radically enhances the built in refactoring support of 2005) and it includes some killer features such as a very fast test runner (sorry Jamie, but on the other hand - you still need Testdriven to get at its wonderful reflector based debugging, among other killer features).

However, it does not natively support the awesome MbUnit test framework... until now - Albert Weinert has created a plugin that make the R# testrunner "mbunit aware"! This is great news. Check it out here. It is fresh and not complete but we really should cheer on herr Weinerts effort.

Meanwhile, Jetbrains have not been totally lazy ;) - if you have not upgraded to 2.5 I recommend it - the speed improvements are substantial to say the least. The difference compared to a vanilla 2005 install is not noticeable on my machine.

Oh, and if you haven't checked out mbunit, do so. They just got a new release off the compilers some weeks ago and it is looking better all the time.

In other blabla, just back from vacation and the mound of work is still just sitting there, I tried screaming at it but it just won't go away.
1/4/2007 2:22:18 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  |  Trackback
 Sunday, January 15, 2006
I've got a cold. It's very often the same after you've been to the alps, you get a cold afterwards. A previous boss of mine used to say that a skiing vacation should be followed by a resting vacation. Many of us devs usually went skiing together and it took a couple of days to get up back to speed. And a cold afterward was not uncommon. Anyway, I'm trying to get better fast, sleeping and reading because tomorrow I will attend Guerilla.NET 2.0 here in malmö. I'm excited to see how developmentor courses are, and if these guerilla courses really are as good as some people say.
1/15/2006 7:00:00 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  |  Trackback