One of the great things about ALT.NET is the variety of choices it affords.  However, this can also become an albatross around your neck when trying to choose a particular unit testing framework, mocking framework, IoC container, etc.  I mean, if you haven't tried most if not all of the choices, then you don't know what you're missing.  Of course you can read about the different options out there, but that's no substitute for trying them out for yourself.  Having said that, there's still a lot of utility in reading about them to exploit them to your advantage.  Thus, I recently moved out of my normal comfort-zone, (NUnit, Rhino.Mocks, Windsor Container) and tried some other technologies. 

What follows is a short description of my impression of a couple of Unit Testing frameworks that I've played with in the past couple of weeks.  Note that this is not intended to be an complete portrayal of each tool, but rather how I felt when attempting to use them.

NUnit

This is the old standby, but there's a 2.5 alpha that I hadn't tried.  I liked a lot of the changes that have gone into it, but found that too many things that I depend on for integrating with NUnit don't work with 2.5 yet.

XUnit

I like XUnit.  It's simple.  ALT.NET takes a bad rap for being hard to adopt, so one thing I try to emphasize is simplicity.  This is XUnit's strength.  If I were starting someone off in Unit Testing, I'd tell them to look at XUnit.  I have to admit that I do like the Constraint model in NUnit, however.  It just reads more naturally.  Also, pretty much everything works with NUnit, but not necessarily with XUnit (like TeamCity, currently).  So eventually, I went back to NUnit 2.4.8.  It worked fine with TestDriven.NET, however.

So the moral of the story is that software (including OSS) has momentum.  Once you get used to a certain way of development, it feels painful to switch, even if the other applications have some nice new features.

Conspicuously missing here is MbUnit, which I've tried in the past but again went back to NUnit eventually.  I'll have to try it out again soon.


 
February 20, 2008
@ 02:41 PM

I'm not dissing MS Unity, Microsoft's new IoC Container - I'm really going to give it a chance.  Rather, I'm talking about the reaction to it on the Yahoo! [altdotnet] group.

I have just spent most of the morning following a thread on the [altdotnet] mailing list titled "Unity" Ioc from Microsoft has been released in CTP...  And it has.  But in retrospect, based on the thread, "Unity" was a very ironic name choice for the tool.  This is a very long thread that is involving dozens of folks.  It started off by comparing the functionality in Unity to functionality in other IoC containers, mostly Castle Windsor & StructureMap.  The Spring.NET crowd has been strangely silent.

Later in the thread, however, the "altdotnet"ness of the list has begun to show its colors. Passions have arisen and tempered.  Staunch defenders of each "side" (and there are more than two sides to this polygon) have held their ground while alternately being gracious one minute and on-the-attack the next.  It's the ultimate Reality TV... except that it's not TV, of course.

I've wasted too much time trying to follow this thread and I declare that I am DONE with it.  Not that the task wasn't worth it.  I've learned a lot about IoC that I hadn't know before.  I'm familiar with Windsor, and I've downloaded Unity and played around with it as well.  The really great gem that I have just discovered is StructureMap.  I just love the "fluent interface" it has - much like is available in Rhino.Mocks.  Fun, geeky stuff.

I thought it would be a useful exercise to compare "Hello, World!" scenarios between the big-four (and, yes, I'm including Unity as part of that):

Function Castle Windsor StructureMap Unity Spring.NET

Putting an interface and concrete type into the IoC container

WindsorContainer. AddComponent() StructureMapConfiguration. BuildInstancesOf(). TheDefaultIsConcreteType() UnityContainer. Register() N/A - Spring doesn't support XMLless config (that I could find).  Those Java guys just have a love affair with XML, I guess
Getting a concrete type for a given interface Resolve() ObjectFactory. GetInstance() UnityContainer. Get()
Default items are Singleton separate instance separate instances

The fluent-interface of StructureMap is so nice.  Yes, it's longer to type, but hey, that's what IntelliSense is fore, and that will make it easier for new developers to discover.

Incidentally, Unity looks an awful lot like Windsor in its syntax, and it was mentioned in the aforementioned thread that the PM on the Unity project is a big Windsor fan.

Apology: I just couldn't resist the lolcats thing, it was just too apropos.  This is my one (1), lifetime, self-imposed limit.


 
February 6, 2008
@ 05:10 PM

A colleague, Daren May, has turned me onto a great Scrum resource, Scrum and XP from the Trenches, which is the best online Scrum resource that I've seen yet.  It's a free PDF book about one ScrumMaster's experience with Scrum.  Most of what I've read about Scrum so far has either been heavy on theory or very "Pie in the Sky"ish. I was so impressed by it that I've emailed everyone I know who's interested in Scrum.

The author, Henrik Kniberg, has a blog that's just dynamite as well.  Lots of good content on agile and Scrum in there.

As I said, I was very impressed, so much so that I decided to pay for a hard-bound copy, which is pretty out of character for me if it's available in a free form.


 
Kick it! Digg it!  Categories: Agile | OSS | Scrum

It doesn't look like Google Reader or FeedDemon are going to work out for subscribing to any of my secured corporate blogs (which currently only consist of my own blog).  Let's give the Windows Common Feed List a try.  Nope.  IE doesn't support "feeds with passwords" as it puts it.  Let's try Outlook.  It looks like Outlook is the only reader (that I know of so far) that handles this kind of feed.  Wow.  I didn't know Outlook had it in it.  Am I ready to leave Google Reader yet?  Mmm... not really, but I'll just have to have separate areas for public and private feeds from now on, however.


 
Kick it! Digg it!  Categories: blogging | OSS | Outlook

January 5, 2008
@ 10:10 PM
Wow, where have I been?  I've taken leaves of absence before, but it seems that I've fallen into "Oblivion."  Oblivion sure is fun, but it's also a complete time-waster.  I need a game that engages me for one hour at a time, about once a week or so.  Oblivion was not that game, it's kind of all-engrossing for me.

But this isn't about Oblivion - it's about security.  A LONG time ago I promised a part 2 to a security blog on passwords, etc.  Now that we know how to choose a good password, it's time to store it somewhere, or them rather.  We don't use the same password everywhere so it may be difficult to remember each and every password, so we need to store our passwords somewhere securely.  Here is what I do (though in revealing this I will expose myself to a miniscule amount of risk by detailing it here - more on that later). 

As far as where to store passwords, I really like TiddlyWiki.  There for awhile it was a close race between OneNote and TiddlyWiki as to what would be my general note-taking tool, but OneNote finally won out since I can use it (kind of) on my Windows Mobile device, and I can't use TiddlyWiki on it.  However, TiddlyWiki wins out on the desktop since I don't have to have anything but a browser. 

I was kind of confused at first about TiddlyWiki - I thought a wiki required a server, but not TiddlyWiki.  It's completely self-contained on a client PC, implemented in JavaScript (amazing, I think).  If you want to learn your JavaScript better, that would be the code to look at.

So TiddlyWiki is a great note-taking/organizing tool, but what about SECURITY?  Enter TrueCrypt.  With TrueCrypt I can create a secure file that acts as a virtual drive, completely encrypted with the absolute latest and strongest encryption available - you can even use multiple encryption algorithms at the same time, but it may be overkill outside the Department of Defense or in large multi-national organizations. Anyway, I place my TiddlyWiki file in a small TrueCrypt partition, and coupled with either FolderShare or Groove you can have your secured passwords anywhere, anytime.

By the way, what pulled me out of Oblivion?  It's Christmas at the in-laws, with the game only on my desktop about three hundred miles away.  [Back home now, and I just gave my wife the DVD and told her to hide it.]

I'm also not posting this entry right away, since my in-laws only have dial-up and about twelve people are all vying for the same 24k baud line.  No cable here in this part of rural West Virginia.  Definitely no DSL.  Satellite would be about the only option, and my mother in-law spam-forward's enough email over dial-up just fine.  I'd hate to see what would happen if they got broadband.  (Just kidding, Barbara.  I'm really happy you took me off of your auto-forward list years ago).  Ironically, for this post, I don't really have access to my passwords out here, but since I don't have Internet access it doesn't matter!

I doubt she'll ever read this anyway.  This blog is pretty narrowly targeted to a particular audience.  When any of my family sees my blog listed in my email signature they visit it... once.  Apparently they have no idea what I'm talking about, though I hope that the past couple are just a tad more general interest than my usual fare.


 

I've done a couple more experiments with a simple "Hello World" version of a Presenter First style app.

With the first one, I've gotten rid of the manual mock objects (less code to maintain) and replaced it with dynamic mock objects from Rhino Mocks. I do believe that Oren Eini has thought of everything when he made Rhino: source code here

And with the second one, I've utilized not only the dynamic mocks, but also Windsor Container for the Windows Forms app, and an auto-mocking container developed by the folks at Eleutian for the TDD test. I must say, however, that it was a little tricky getting the Presenter object in the right state for auto-mocking + testing. At first I couldn't "auto-mock" the Presenter object before I'd obtained the View mock. The Presenter constructor was setting up the event subscription to the view, but I couldn't get to the Auto-Mocked view until the Presenter constructor was already called, which messed up my mock recording/playback sequence. Therefore, I had to add an "Initialize" method to the Presenter object. Again, it's a little more code in the short run, but if this were an extensive application, there would be a heck of a lot less monotonous configuration code for all the dependency injection stuff. I love the fact that the Windows Forms app has absolutely no idea what objects are being created for its use. That's all up to the configuration file: source code here


 

As mentioned in my last post, my first "Tech TODO" was to wrap my head around the "Presenter First" pattern. There are several videos (part 1, part 2, & part 3) from Ron Jacobs on the concept, and he spoke about it at Tech Ed 2007 in Orlando as well. The guys at Atomic Object also have several papers and what they consider a pretty simple example of Presenter First in action. Now, I'm not an agile newbie. I've written a couple apps that use the "Humble Dialog" approach to separating the GUI from the business objects in a testable way, but I could not for the life of me figure out how to "do" Presenter First from any of the available stuff online. Well, I did figure it out, but it took way-longer than I thought, based on how everyone was saying it was such an easy concept. Frankly, if you're not used to using events and delegates, it takes awhile to grok.

So in the spirit of sharing, I'm posting my first go-around with Presenter first. This is by far the simplest version of a Presenter First style app I've seen to date. Granted, it's useless for anything except to help you understand Presenter First, but then again, that's its purpose.

There are only about 50 lines of code, and honestly, Mort would have done this in about one line of code after double clicking the form's only button in the designer, but the thing is, he could never have automated tests for it! This is a case where the outcome (testable GUI) is worth a little extra work.

There following files are the interesting bits – first for the testable part:

  • IModel.cs & IView.cs – the interfaces for the model and view (duh)
  • MockModel.cs & MockView.cs – these are "manual mocks" (I wanted to keep it simple) for testing, and since I don't yet understand how to mock events and delegates in Rhino Mocks, yet.
  • Presenter.cs – the glue that ties things together, and more or less the main character in this exercise.
  • Test.cs – contains the Unit Tests for… testing

…and finally for the "live" windows form app:

  • Model.cs – the "real" model, and a very simple one, indeed (Prints "Hello world")
  • View.cs – a Windows Form, and the "real" view
  • Program.cs – the app runner, for any normal windows forms app

So there you go. You can get the source code here. Enjoy!


 
June 22, 2007
@ 08:17 PM

I'm almost afraid to post this because the list will be so long. Anyway, here are some technologies in which I'd like to be proficient in the not too distant future:

Presenter First pattern

Unit testing for GUIs (a TDD technique)

MbUnit

Unit testing tool. From now on, I'll only use NUnit when it's the client's choice. I hear that the "Mb" stands for "much better".

Rhino Mocks

The best mock object tool out there.

log4net

A tool to help output log statements to a variety of output targets

Castle: MicroKernel & Windsor Container

My current "Dependency Injection Container"

Castle: ActiveRecord

Data access later from the Castle project based on the ActiveRecord pattern. Built on top of NHibernate

Aspect#

An Aspect Oriented Programming framework for the .NET framework

MonoRail

Basically, Ruby on Rails for .NET

Dynamic Proxy

For creating lightweight proxy objects on the fly in .NET

NVelocity

Kind of like ASP.NET's <% %> functionality, but with better MVC semantics (useful for MonoRail, I think)

MS Windows Communications Foundation

Next-gen web services from MS

MS Windows Workflow Foundation

Create "resumable" applications

MS patterns & practices Application Blocks

  • Caching
  • Composite UI
  • Cryptography
  • Data Access
  • Exception Handling
  • Logging
  • Policy Injection
  • Security
  • Validation

MS patterns & practices software factories

Something for Mort (I'm not Mort, though. I'm more like Hugo). Sometimes you gotta suck it up and take one for the team, though.

  • Mobile Client
  • Smart Client
  • Web Client
  • Web Service

ASP.NET AJAX

I guess I've dodged this bullet long enough.

 

My current competency in these technologies ranges anywhere from semi-competent, to inept, to "all I know is that it sounds cool".


 
May 4, 2007
@ 06:32 PM

Apparently I'm just dangerous enough to really screw things up in a blog that I have absolute control over.  Thus my old "Community Server 2.1" blog is toast.  Since I'm supposed to be learning WSS 3.0 anyway, I thought this was a good opportunity to start a little "dogfooding".


 
Kick it! Digg it!  Categories: OSS | SharePoint

May 2, 2007
@ 06:16 PM

I just embarrassed myself.  I was on a conference call in which I was supposed to be talking about Visual Studio 2005 and development methodologies.  I proceeded to do so and was presenting what I thought was a balanced view of both what is available from Microsoft and what's available as Open Source (NUnit, CruiseControl, etc.), when my sales counterpart, who is sitting with the client and can see their faces, cuts me off, trying to save me some "face".  Apparently this client is absolutely against open-source, giving what I consider the lame excuse of "who do you call for tech-support?"  I reply that I've had much better experiences getting help with open-source software than with commercial software.  I hear some laughing, so I realize the hole I'm digging for myself is only getting deeper.  The call ends not much later than that.

 Now don't get me wrong.  I love Microsoft.  They're my bread and butter.  As much as I love SharpDevelop, it really can't compete with VS 2005 + Resharper in most regards.  But, I doubt that my dream environment will ever include Team Foundation Server.  Maybe, but I doubt it.  Let's face it.  Some things Microsoft does better.  Some things open-source does better.

This wasn't the first time that I've run into the prejudice against open-source.  But as someone who always uses it in some form or another, it's easy for me to forget that there are those who for whatever reason, will never use it.  Next time I'm slated to talk about "dev environments", I'm going to ask a pre-talk question on where people stand on Commercial vs. Open Source.  Red, Green, Refactor - it can work for sales pitches too.


 
March 29, 2007
@ 05:09 PM

You may think I've been slacking, but really I've been scouting out new free technology!  WatiN is a very useful tool for performing web application testing. http://watin.sourceforge.net/.  A necessary companion to WatiN is a free tool from Microsoft called the IE Developer Toolbar.  Why have I never used this before?!?!  Thanks to Justin Miller for pointing me toward WatiN!

And of course this is still in the screen-cast series, so you won't get away without the obligatory WatiN Screen Cast (24+ MB)


 
March 6, 2007
@ 05:25 PM

Like I've said before, FxCop can be a pain in the patootey.  But it feels pretty nice when you run it and don't get any warnings.  This is a quick overview of how to use FxCop.

By the way, I apologize for the sound - something was up with my mic, apparently, but it should be OK if you turn up your volume.  I'll try to fix this before the next one.

 FxCop Screencast


 

This is a short one since I'm short on time.  I did want to get something out however, so here it is.  Enjoy the NCover screencast


 
March 4, 2007
@ 04:00 PM

NUnit is my unit testing tool of choice. I remember a few years ago when I was trying to figure out all of this automated unit testing stuff and the problems I had learning without someone to show me how. I hope that this screencast can make the introduction to automated unit testing a little simpler and make testing in particular more prevalent with those who view it.

NUnit Basics


 
I've used Visual Source Safe in one form or another for about 11 years now.  It always seems like that's the only feasible answer to the small 5 developer or less projects to which I'm usually attached.  I guess I've learned to live with it's warts, but need for distributed access to source control has forced me to consider alternatives.  I know that VSS 2005 has this capability, and I've gotten it to work... about 60% of the time.  And it's not free either, so when it's time to leave a project, what do we do with the source code, especially if your client has been using the SCM tool alongside of you?
 
I looked at CVS, but man it was slow.  I looked at Vault, and that sure wasn't free (for more than one user).  I began seeing references to Subversion, but I thought (incorrectly) that it required Apache, and I wasn't ready to make that commitment yet (there's still a little MS koolaid flowing through my veins).  A colleague mentioned it recently and that caused me to go back and take a second look.  I'm glad I did, because Subversion and its client of choice for Windows - TortoiseSVN is my favorite SCM solution now - free or otherwise.  I'm definitely going to be using it on my next project if the customer doesn't already have a SCM solution in place. 
 
Anyway, here's my overview of Tortoise SVN for VSS Users:
 
Oh, and TortoiseSVN is also integrated with SharpDevelop - another big plus.

 
Kick it! Digg it!  Categories: OSS | SCM

March 1, 2007
@ 01:11 PM
Well, it's time to try out OmniDrive.  Here's the screen-cast I was promising...

 
February 27, 2007
@ 01:09 PM

Well, here's how the final image ended up.  This image of MS dev tools won’t violate any license agreements when it’s left at a client site.  The VM was just a bit over 2GB, zipped.

It’s a VMware Workstation 5 compatible image with:

  • Win XP SP2, including all up-to-date high-priority updates.  When you leave an engagement, simply run the sysprep tool and the customer is forced to enter their license key for XP during the next boot.
  • SharpDevelop 2.1 – .NET IDE (my favorite discovery so far)
  • Microsoft Visual Web Developer 2005 (with SP1) – ASP.NET 2.0 development IDE
  • Microsoft SQL Server 2005 Express (with SP1)
  • Microsoft SQL Management Studio Express
  • Subversion Source Control server (Finally, no more VSS!)
  • TortoiseSVN – Subversion client (integrated within the Windows shell – nice)
  • NUnit 2.9 – Unit Testing (comes packaged with SharpDevelop 2.1)
  • NCover – Code Coverage
  • Cruise Control 2.1 – Continuous Integration
  • NAnt – Build tool
  • FitNesse – Acceptance Testing platfom
  • FxCop

Each of the tools is used in a sample project to demonstrate its function and usage.  I also plan to put together several screen-casts to highlight each tool in the environment.  The one thing that didn’t make it into the environment was Selenium – I may just code my own web testing tool just for the fun of it.


 
February 26, 2007
@ 09:42 AM
Most likely it's just my noobishness with Selenium but I can't get it to work in some of the simplest scenarios sometimes.  So for now I'm embracing the philosophy of "The Humble Dialog" and discover ways to move functionality out of the UI and into the non-UI objects themselves. Model-View-Controller and all that.  In the future I'd like to build my own web-testing software - I'd make it free. 
 
The best Web-Testing framework I've ever used comes with Visual Studio 2005 Team Suite (or test), but for my "free" project that just won't work, because Team Suite and/or Test are definitely not free.

 
February 25, 2007
@ 09:41 AM
CCNET 2.1 is still in beta, but one of my favorite (though yet to be tested) new features is the support for FitNesse testing.  Now your customers can not only see that your code both compiles and passes all tests that you have designed, but they can see that the code also passes all the tests that they have designed as well.  I look forward to using tis feature on my next project. 
 
One thing to watch out for, however, is that there is currently a bug in the dashboard.config file attempting to reference FitNesseReport.xsl, which doesn't exist.  Just change that to FitNesse.xsl and things should work better - at least it doesn't yield exceptions.  It does have a picture that's not showing up correctly, but that should be corrected before long (I hope).
 
Now, if only I could get my customers to write some fitnesse tests!

 
Kick it! Digg it!  Categories: OSS