Andrew Stopford's Weblog

poobah

Sponsors

News

Articles

Family

Old Blogs

December 2006 - Posts

A look ahead at 2007

Its that time of year again and as is custom on my blog I'll look back at the predictions I made this time last year and my predictions for 2007. Heres what I predicated and how it turned out.

TD.net will rock and rule the world in 2006, Jamie is going to spring some real joy in 2006.

TD.net 2.0 was released this year.

Already this year we have seen major growth in Web 2.0\AJAX and thanks to Google and others 2006 will bring more of the web 2.0 vision into life

Microsoft announced and built their own AJAX tookit this year with some serious web 2.0 sites built on it. AJAX has also literally exploded this year with a great deal more web 2.0 sites than this time last year.

Java will go opensource, with IBM\Apache creating a opensource Java, Sun will start the wheels turning and a new foundation will be started to make Java OSS.

Java was opensourced by Sun this year.

.NET 2.0 Rotor will see the light of day.

Rotor 2.0 was released this year.

Mono will fully support .NET 2.0, the Mono JScript engine will make it to the offical distro and XBuild will become as fully functional as MSBuild and become the Mono compile engine.

Mono does support .NET 2.0 however Mono JScript is quite in the offical distro yet but on the source brance. XBuild is not being used for the purpose I described.

Adobe (Macromedia) Flex will show some real muscle in 2006 and will be a tour de force in bringing RIA to the enterprise Java world. 2006 will not see .NET support (and by 2007 I'll still be waiting).

Flex 2.0 was released this year and does indeed cement it's place in the Java RIA world, no .NET support came in 2006 and with 2007 very neally here I am still waiting.

Microsoft will open up folly after folly at the RIA world, WPF, Sparkle, Orcas, Vista. By the end of 2006 Microsoft will still be the only provider of .NET applications and solutions to the RIA space and everyone else will have missed the boat completely (and by then it will be too late to catch up)

I was right here too, WPF is a part of .NET Framework 3.0, it's bundled in Vista and Blend (aka Sparkle) has made massive ground this year. Microsoft wrapped up this years follys with WPF\E and yes they are the only provider in the space.

For the first time since I started making end of year predictions I've managed to get every single one right. The one I am most disapointed about is Adobe, I can see clearly that really don't care about the .NET developer audience. I've wanted to be proved wrong about them many times but I am pretty much always right, I've given up on them now. This year has been a tough year for Jamie, lots of reasons why but Jamie will bounce back with a vengage and I look forward to what he's got cooking in 2007.  Next year will be a telling year for Java, being open sourced is one thing but making it succeed as project and working for Sun as something they can actually make money from is another. I am sure it will work out and next year will see a lot of that working out getting done. By the time Mix 2007 swings around Microsofts RIA picture will be even stronger.

When I reflect further on 2006 its been an really amazing year, I've been to Vegas (for Mix 2006), Seattle (and once again thank you Joe), Reading and London (all Microsoft HQ's). I've had the unique chance this year to sit with and question Microsft greats like Anders, Don Box and Jim Hugunin and jammed with Scott Gunthrie. It was also great to meet big minds from the PHP and Rails worlds and talk about Microsft thinking and technologies. I've started attending as many of Phil's curry nights as I can and thanks to Phil I've had the chance this year to meet and chat with some of the big thinkers here in the North West of the UK, Phil is the nicest and funniest guy I know. Back in the summer I took Jamie to my local pub for some good food and a chat, it was good to finally meet someone I have so much respect for. This year I was made a member of the ASP Insiders, I missed the yearly summit this year but hopefully next year. MbUnit has had a amazing year, we reached the 2.3 milestone and many of my follow bloggers have seen the light and starting putting MbUnit through its paces on their projects. I've also managed to break my lowest and highest blogging count records this year, March was a good month, November was not.

So onto my predictions for 2007, these are getting increasing harder to do thanks to mr nda however here's some that are safe.

  • 2007 will be the year of patterns and testability (or I'll die trying).
  • MonoRail will go 1.0 RTM, I think that more folks will take up MonoRail on their projects and a book or two will appear.
  • MbUnit 2.4 and MbUnit 3.0 will see light of day in 2007, MbUnit 2.4 will be a shift and MbUnit 3.0 a change. MbUnit 3.0 am I really excited about and its getting the stuff out of my head and into code.
  • 2007 will be an interesting year in general for unit test frameworks, Peli's back in test research (and expect that to see light of day in 2007) and Charlie has NUnit cooking on a roaring fire. Expect to see some very cool stuff show up in 2007 for that.
  • Mix 2007 will also see some very cool stuff show up for its subjects of web and RIA, no I can't say what (again with thanks to mr nda) but if you missed the show this year then don't miss out in 2007.
  • Microsoft's Ray Ozzie will take the helm fully in 2007 and more shifts in thinking will appear, Microsoft will also hire more minds into the company (they round off 2006 with Jon Udel's appointment). I think Ray will do the keynotes at Mix and PDC.
  • Mono will get a BOF at PDC 2007, the up roar that followed the last one and the Mono BOF issues and the recent issues folks have had with Microsoft and OSS in their own space means that this should happen for PDC 2007.  I hope a few testing BOF's and sessions show up at PDC 2007 too. 

Thats my lot, have a great and safe news year eve and see you in 2007.

MbUnit, news-worthy odds and ends

Some odd's and ends from the MbUnit world.

Posted: Dec 30 2006, 05:04 PM by andrewstopford | with 1 comment(s)
Filed under: ,
C# generics covariance

I've posted about this before, largely covariance is possible in C# delegates but not featured in generics. However the CLI supports generics through out as this post from Rick Byers indicates.

...CLI supports covariant and contravariant generic parameters, with the following characteristics:

·         It is type-safe (based on purely static checking)

·         Simplicity: in particular, variance is only permitted on generic interfaces and generic delegates (not classes or value-types)

·         Languages not wishing to support variance can ignore the feature, and treat all generic types as non-variant.

·        Enable implementation of more complex covariance scheme as used in some languages, e.g. Eiffel.

The discussion in that post on Eiffel supporting covariance by default and the appoach taken by Java 1.5 in its generics support is well worth a read. Rick also shows how you can use type inheritance and base type constraint to allow for covariant style behaviour in C#.

Posted: Dec 28 2006, 02:53 PM by andrewstopford | with no comments
Filed under:
MbUnit, repeating tests.

MbUnit (2.3 onwards) has support for repeating tests either in the same thread or in concurrent threads.

  1. [Test]
  2. [Repeat(10)] // this will make the RepeatedTest executed 10 times
  3. public void OneThreadRepeatedTest()
  4. { ... }
  5. [Test]
  6. [ThreadedRepeat(10)] // this will make the RepeatedTest executed in 10 concurrent threads
  7. public void ConcurrentThreadRepeatedTest()
  8. { ... }

How this is used needs careful consideration when used with other method attributes e.g.

  1. [Test]
  2. [Repeat(10)]
  3. [ExpectedException(typeof(Exception))]
  4. public void RepeatAndThrow()
  5. { ... }
  6. [Test]
  7. [ExpectedException(typeof(Exception))]
  8. [Repeat(10)]
  9. public void ThrowWhileRepeating()
  10. { ... }

Here RepeatAndThrow will run the test 10 times and expect each test to throw an exception. However ThrowWhileRepeating will also run 10 times and expect at least 1 of the tests to throw an exception.

Posted: Dec 28 2006, 02:11 PM by andrewstopford | with 2 comment(s)
Filed under: ,
MbUnit, testing with cultures.

If you code using cultures and that needs to be a factor in your tests then MbUnit (2.3 onwards) provides the MultipleCulture method attribute. This takes a comma delimited list of cultures e.g.

  1. [TestFixture]
  2. public class MultipleCultureAttributeTest
  3. {
  4. [Test]
  5. [ExpectedException(typeof(AssertionException))]
  6. [MultipleCulture("en-US,de-DE")]
  7. public void TestConvertFromString()
  8. {
  9. string input="2.2";
  10. double output = double.Parse(input);
  11. Assert.AreEqual(2.2, output);
  12. }
  13. [Test]
  14. [ExpectedException(typeof(AssertionException))]
  15. [MultipleCulture("en-US,de-DE")]
  16. public void TestConvertToString()
  17. {
  18. double input = 2.2;
  19. string output= string.Format("{0}",input);
  20. Assert.AreEqual("2.2",output);
  21. }
  22. }
Posted: Dec 28 2006, 02:03 PM by andrewstopford | with no comments
Filed under: ,
MbUnit, testing IEnumerable/IEnumerator types.

MbUnit 2.3 onwards has support for testing collection types that inherit IEnumerable/IEnumerator using the EnumerationFixture class attribute and DataProvider method attribute. The DataProvider method attribute allows you to mark a method as your collection populator so they are ready for testing.

  1. [EnumerationFixture]
  2. public class EnumerationFixtureAttributeAttributeTest
  3. {
  4. private Random rnd = new Random();
  5. private int count = 100;
  6. [DataProvider(typeof(ArrayList))]
  7. public ArrayList Data()
  8. {
  9. ArrayList list = new ArrayList();
  10. for(int i=0;i<count;++i)
  11. list.Add(rnd.Next());
  12. return list;
  13. } [CopyToProvider(typeof(ArrayList))]
  14. public ArrayList ArrayListProvider(IList source)
  15. {
  16. ArrayList list = new ArrayList(source);
  17. return list;
  18. }
  19. [CopyToProvider(typeof(int[]))]
  20. public int[] IntArrayProvider(IList source)
  21. {
  22. int[] list = new int[source.Count];
  23. source.CopyTo(list,0);
  24. return list;
  25. }
  26. }
Posted: Dec 28 2006, 01:52 PM by andrewstopford | with no comments
Filed under: ,
Web frameworks 2006

I am writing this now as the end of the year approaches as I am sure that by the end of 2007 the web framework landscape will have changed again. Only a few years ago a web developer had Perl\CGI then along came ColdFusion, ASP and PHP. Until recently that's the way it was for web developers and very often each company would cook their own bespoke web framework with varying power around these. Then some chaps looked at Ruby as much more powerful dynamic language and cooked up Rails, no need for bespoke when now have a very powerful one to hand that you can adapt.

Of course in between these was JVM\Structs and CLR\Webforms but the need for complete control over output (and in some cases control over every inch of the framework) ment that these did'nt factor in some cases. Rails is gaining new members of its audience every day, drawn by the fact that it lets you get your job done quickly (like common database tasks with a ORM, like common output rendering, like moving databases etc) with control and with adaption. For the power users the appeal of Ruby as the language of Rails is big, I've not seen such raw OO power since Lisp CLOS.  As a framework Rails builds in good design, it follows MVC and when you use Rails to build your web application you in turn follow MVC. Lastly and most importantly Rails has testability baked right in.

Rails has started something, already other frameworks are coming into the public domain, SeasideDjango, Erlyweb and more recently Scala on Sails. The impact of Rails onto Java and .NET has already lead to developments such as JVM\Sails and CLR\Castle MonoRail.

So in 2007 I think many of the ideas from Rails such as ORM's, migration and true MVC will finally reach the main stream. I think that adoption rates for these frameworks will increase as well, performance issues are a big limiting adoption factor but 2007 should see the introduction of performance boosting VM's for Rails in YARV (already being readied to be merged into Ruby), for Django in PyPy, and for Sails in the JVM\Hotspot.

MbUnit.net

MbUnit has a new domain, http://www.mbunit.net, this was donated by Patrick Bohan. Please also note that MbUnit.org has expired and is no longer related to MbUnit, please use http://www.mbunit.com when linking to the project.

Posted: Dec 22 2006, 05:39 PM by andrewstopford | with no comments
Filed under: ,
Composite unit testing with MbUnit

One problem when creating unit tests is avoiding writing the same code over and over for testing related functionality. MbUnit has some features that allow you to avoid this using an approach called composite unit testing. Rather than rehash here its better that I point you at Peli's orginal article over on CodeProject that explains this approach, along with the documentation on the MbUnit wiki. It's a powerful way of approaching the problem.

Posted: Dec 21 2006, 11:00 AM by andrewstopford | with no comments
Filed under: ,
Testing private methods, new to MbUnit 2.4.

Update: This is available in build 2.4.28 onwards

I know that some consider testing private methods wrong (its a topic of some debate) but others find it a useful and wanted feature and frameworks like TestNG and MSTest let you do this if you want to. Ben Hall contributed this feature which builds on using Reflection to expose private methods and builds on the work done by Chris Holmes and Tim Stall. This is the first addition to the new mbunit.framework.2.0.dll that will ship with 2.4, to use this functionality you will need import that dll along with the standard mbunit.framework.dll file. So taken a simple example file

  1. public class TestSample
  2. {
  3. private int counter = 0;
  4. private bool accessed = false;
  5. private void IncCounter()
  6. {
  7. counter++;
  8. }
  9. private void SetAsAccessed()
  10. {
  11. accessed = true;
  12. }
  13. }

We could run a test as follows

  1. using MbUnit.Framework.Reflection;
  2. [TestFixture]
  3. public class ReflectorStaticTests
  4. {
  5. TestSample sampleObject;
  6. [SetUp]
  7. public void Setup()
  8. {
  9. sampleObject = new TestSample();
  10. }
  11. [Test]
  12. public void RunPrivateMethodOnObjectUsingStatic()
  13. {
  14. Reflector.RunNonPublicMethod(sampleObject, "IncCounter");
  15. }
  16. [Test]
  17. public void CheckPrivateValueOnObjectUsingStatic()
  18. {
  19. object result = Reflector.GetNonPublicVariable(sampleObject, "counter");
  20. Assert.AreEqual(0, (int)result);
  21. }
  22. [Test]
  23. public void RunPrivateMethodAndCheckPrivateValueUsingStatic()
  24. {
  25. int execute = 3;
  26. for (int i = 0; i < execute; i++)
  27. Reflector.RunNonPublicMethod(sampleObject, "IncCounter");
  28. object result = Reflector.GetNonPublicVariable(sampleObject, "counter");
  29. Assert.AreEqual(execute, (int)result);
  30. }
  31. }

This example calls the methods by passing the instance you wish to reflect (in a static fasion) but the code also allows you do the following.

  1. [TestFixture]
  2. public class InstanceTests
  3. {
  4. TestSample sampleObject;
  5. Reflector reflect;
  6. [SetUp]
  7. public void Setup()
  8. {
  9. sampleObject = new TestSample();
  10. reflect = new Reflector(sampleObject);
  11. }
  12. [Test]
  13. public void RunPrivateMethodOnObjectUsingInstance()
  14. {
  15. reflect.RunPrivateMethod("IncCounter");
  16. }
  17. [Test]
  18. public void CheckPrivateValueOnObjectUsingInstance()
  19. {
  20. object result = reflect.GetPrivateVariable("counter");
  21. Assert.AreEqual(0, (int)result);
  22. }
  23. [Test]
  24. public void RunPrivateMethodAndCheckPrivateValueUsingInstance()
  25. {
  26. int execute = 3;
  27. for (int i = 0; i < execute; i++)
  28. reflect.RunPrivateMethod("IncCounter");
  29. object result = reflect.GetPrivateVariable("counter");
  30. Assert.AreEqual(execute, (int)result);
  31. }
  32. }

Here the reflector instance is passed a object instance and methods are called on that instance, it saves you having to pass object instances around but it's really down to preferance.

Posted: Dec 20 2006, 02:07 PM by andrewstopford | with no comments
Filed under: ,
More Posts Next page »