Monday 17 November 2008

Sunday 16 November 2008

At Home

Finally at home - a chance to relax. I'm downloading all the sessions powerpoints and any other resources I can find so that we have them available.

Friday 14 November 2008

The end of Tech-Ed but not the end of the Tech-Ed Blog

We've left the Tech-Ed forum for the last time now - and to be honest I'm a bit sad. Is it because of the sense of community? The sense that I am a professional developer? Maybe being around and recieving so much stimulus about so much cutting edge technology - and when i say technology i don't actually only mean the technical side of it - because allot of what we saw related to processes and practices.
We've seen stuff about the future and stuff about the pressent. In deapth and dreadth we've swayed (just for the sake of being poetic).
Anyway, the point is that we'll continue this blog untill we mange to add at least some information about all the sessions we attended.

.NET Framework: Application Life Cycle Best Practices

At the beginning of the week I went to a session of best practices for .NET framework application. This was in hope of finding answers to what is the best way to version and distribute .NET application. Unfortunately session didn't provide much information I didn't already know - and worst of all things I'd learnt the hard way.

The session started out to answer three questions:
  • How to install the .NET Framework
  • How do I share libraries or components
  • How do I make my app start faster
How to install the .NET Framework

Basically we were shown how to tell VS installer project to install the .NET framework. This can be either downloaded from the web or included as part of the installation. The only new thing that was mentioned is the '.NET Framework Client Profile'. To quote MS:

'The .NET Framework Client Profile is a subset of the full .NET Framework 3.5 SP1 that targets client applications. It provides a streamlined subset of Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables rapid deployment scenarios for WPF, Windows Forms, WCF, and console applications that target the .NET Framework Client Profile. '

Sharing .NET Assemblies

The issues that were covered here were: how to share a /NET assembly and how to version it. Basically, we install them to the GAC. However, nothing was said about multiple applications installing uninstalling same file and if this is handled by the method he showed us using VS.NET. With respect to versioning, when a new version is to be built, the question to ask is what is the new version for? Is it to add new features or to fix existing features? In the first case, the strong name of the assembly must be changed - so changing the version number will do this. This way, an old version and a new version of the same assembly can be installed side by side in the GAC. If it is to fix something, when two options are possible. The first is not to change the version, in which case the new version will replace the old one. If however the new change is a breaking change, this is not a good idea. The next option is to change the version number. However, in this case, applications using the old version will have to be configured using the 'Publisher Policy' to use the newest assembly.

Performance

Traditionally, we were told, strong named assemblies may have been installed to the GAC in order to speed up their loading time because the strong name of assemblies in the GAC is only verified at install time. However, .NET 3.5 SP1 has a new feature called 'strong name bypass'.

Finally we were shown a tool called that has been in the framework for a while that I was not aware of called NGen. This recompiles IL into native code so that assemblies load faster. This must be done when installing assemblies, and must be re-done every time an assembly is updated. We were also told that in .NET 3.5 SP1 there has been a lot of work done on cold start-up time, and this has been reduced by up to 20%

Deep Zoom

For those of you that don't know what deep zoom is, just take a look at the Memorabilia section on the Hard Rock Cafe website. Another good application shows all newspaper headlines about Obama after the election (here). Now we were shown how to set up deep zoom for a silverlight application, so don't know if it will work on a WPF application, but my guess is we can find a way of making it work.

In fact it is extremely easy to do using a tool called Deep Zoom Composer. The person doing the presentation literally too about 3 minutes to get a silverlight up and running using deep zoom composer. The very interesting thing was when he started adding extra functionality to the application using a combination of Expressions Design, Expressions Blend and Visual Studio, because i had the chance to see how the tools are ment to be used with each other to create amazing looking UI very easily.

Now the Deep Zoom demo wasn't the WOW factor of this session. It was what is called Photosynth. This is something has hasn't completely been released, but there is an online service that allows you to set something up and use it. It used 3D WPF stuff, so it doesn't work as part of silverlight. Anyway, the idea is this (and brace youselves, because if you don't get impressed it's probably because i haven't manged to get accross what you can do), you basically take many pictures, from close and far and round up down (whatever you want) of an area. Then you can have them atomatatically put together into a deep zoom enabled environment that alows you to zoom in out as well as pan and rotate in a 3D virtual like tour of the area you photographed.

Now i know it sounds weird and hard to explain, but take a look at http://photosynth.net/. We've been busy taking many photos of our room, and the Tech-Ed exibition area to try and use this to do a demo when we get back. Where can we use this? Well i'm not going to give you the answer. Just a good clue: real-estate applictions?

The Future of Unit Testing

I managed to get the powerpoint presentation for this session. So there's not much point copying all my notes here. The bottom line is:
  • UI unit testing is hard, and doesn't look like it will be cracked soon.
  • Unit testing multithread stuff is probably the next big thing. Microsoft has been investing in better debug suport for multithread apps as well as visualizers and analysers. Some of these things we'll be seeing is VS.NET 2010
  • PEX is a project that aims to auto-generate tests. There is a danger that this will be obused. It essentially can only test edge c onditions with respect to if app code crashes or not. Logical tests must still be manually performed.
  • Current we page testing tools (e.g. Watin, Watir) don't test AJAX stuff, so that has to be addressed
  • JsUnit for javascript
  • Adoption rate with respect to Unit testing and test driven development still needs to achieve a critical mass
  • IOC containers. Very important.

Thursday 13 November 2008

Designing for Testability

For each piece of coded logic in the system, a unit test can be written easily enough to verify it works according to the PC-COF. The PC-COF are characteristics that must be true of the tests. They are as follows:
Partial test runs are possible.
Configuration not needed to run tests.
Test fails / passed Consistently.
Order in which test run does not affect the results.
Tests run Fast

Then we were shown the main ideas behind this is to use ‘Dependency Injection’ (also see Wiki on DI and MSMagazine). DI is about, instead of a class creating its own dependencies, they are given to it (either through maybe a constructor, or via properties). This allows us to give a class ‘fake’ dependencies that will behave in a specific known way in order to test them. It also brings our designs closer to the S.O.L.I.D principles of object oriented design.

However, the problem with using DI, is that very soon you come across constructors that need to take very many parameters, and objects than need many lines of code just to construct them. Step in IOC Containers. IOC containers are like smart factories. They can be configured either via code or via configuration file to create instances of objects. Thus, even though constructors take many arguments, by using the IOC Container, object creation is simplified. I’m hoping to give you guys a demo off this when I’m back. There are a number of IOC Containers out there at the moment. The most popular is Castle.Windsor and Unity is from Microsoft’s Patterns and Practices.

So going back to testing, is our system is designed to use DI, we can inject fake implementations of each dependency of the class we are testing so as to test only that class.

A final few notes that were said:
It may often seem that testability clashed with encapsulation which we are traditionally told to practice in object oriented design
Tests show intent so we can use them as requirement

So that was the main part of that session. Just a quick note, the guy mentioned we should take a look at ‘TestDriven.NET’ which is a very usefull plugin for VS.NET as well as ReSharper.

Now this session was so another day I went to another session on the future of unit testing...