Sunday, 4 February 2007

WebDD

Jeff Attended the first WebDD event at Reading on Saturday and it was tops :)

Spent the whole day in Chicago 1 where Scott Gu was presenting but it was a bit of a mission to get a seat!! They really should of guessed that everyone would have wanted to attend his sessions and used both Chicago 1 & 2 to get everyone in. I think a lot of people were turned away to all 4 of his sessions. All of his sessions were recorded though so I'm sure they will be posted on the WebDD site at some point soon.

His first two sessions were a part 1 & 2 of building a complete website from end to end using ASP.NET 2.0, AJAX, VS2005 & IIS7. Most of the stuff in these sessions was quite simple but I found the info on IIS7 really good as I haven't used or read up on this new version yet. He also showed some good tips and tricks which are all on his site.

His next session was a sneak peak at the next version on Visual Studio code named "Orcas". This was a really interesting session, he was using a very recent build which he said will be public download in a couple of weeks (I think i will be installing this :)). The main cool points were:
  • Backward compatibility with v2.0, v3.0 and the new v3.5 of the framework.
  • Inclusion of all the Expression Web features (I think he even said this will be in the Express edition!!) I really like the CSS features, I think these will really help me :) We now have a split screen mode with design and code, and its a lot quicker to switch between the two!!
  • Full support for AJAX including Javascript intellisense and debug :)
  • Full support for LINQ and BLINQ :)
  • plus loads more stuff I can't remember now!!!

The next session was by a guy from Telerik on creating AJAX extender controls. Unfortunately the guy was quiet and had quite a strong foreign accent which made him hard to understand!! However he really did know his stuff!! The session was in-depth, with lots of code and quite interesting - I need to go through the AJAX clientside framework because I didn't really understand this part of the talk!!

The final session was back over to Scott (he probably needed the break as he re-ran his last session through lunch for those who couldn't get in the room!! He did mention he done a webcast - so look out for that :)) This session was on WPF/E and he showed some excellent demos and ran through the code step by step. He showed us this really cool vista emulator done in WPF/E over here, its in some foriegn language, he didn't seem to know who the author was but it was quite funny and shows the power of this technology!! I want to try and use this for a video player in my project but he did say it will only play WMV format, which is an awesome codec (HD 720p quality with low bandwith) but might cause me some problems :(

Scott said he will be posting all his slides and code on his site at some point.

We also all got a free copy of Expression Web which was cool, got a few other bits of swag which is always a bonus :)

A really good event, I think Scott being there really made it for me :) But I will defiantly be signing up again for WebDD2!!

Thursday, 11 January 2007

Lack of posts - my bad :(

Jeff Just want to say sorry for the lack of good blogs lately, had lots on at work (classic excuss!!) I have got a long list of things i want to blog, just need to get round to it!!

Back to it....

Wednesday, 10 January 2007

We've moved our blog

Jeff

We decided to take the hit and move our blog from our own hosting server to the blogsport domain. We took the hit as some of the new blogger features (namely the widget framework) can not be used if you host your blog off their servers via ftp. We really wanted to tag all our blogs and create a tag cloud and this was easy with the new blogger features.

We used this post to help us write the cloud so all credit goes to the author - thanks :)

Also thanks to Scott for doing all the boring moving and tagging of our blogs - I was more the project manager!!! (or to put it another way did nothing!!) We did both muck in learning the widget framework though - some cool stuff there :)

Tuesday, 5 December 2006

DDD4 Wrap up

JeffAttended my 3rd DDD day on Saturday and these days just keep getting bigger and better :) The only down side of this one was the lack of SWAG :( I think Richard and Dave had it all for there session on Tech Ed 2006!!!

Went this year with Ben who is a Microsoft student partner for University of Hertfordshire where he is in his final year of his Computer Science degree :)

Arrived nice and early for the egg, bacon, and sausage baps - yummy :) Then headed into the first session I chose entitled 'How to write crap code in C#' by Ben Lamb. Unfortunately this session was not as great as I expected, I think Ben has a lot of knowledge but came across quite nervous and difficult to follow at times due to this. I feel for him though because I would be nervous in front of 120 people!! He covered a few simple anti-patterns including string concatenation, threading, and throwing errors. He managed to dramatically slow processing down by concatenating strings instead of using the new string builder - there was a huge difference in this. So defiantly use the string builder if your are performing a lost of string concatenation.

Next I joined Dave Verwer for his presentation titled 'Ruby on Rails for .NET Developers'. This was a fantastic introduction session to the dynamic Ruby language and the Rails framework. I defiantly see this technology as a start of a more dynamic like language trend. I think the power and RAD type capabilities of this language and framework are fantastic, he demonstrated how easy it is to create a database and web form in a matter of minutes :) I defiantly see this complementing an AGILE type methodology. I really liked the way it creates a strict model for you to develop within by creating template folders and files and leads you to develop within a tried and tested fashion. People may argue that this is too much hand holding and forcing you to develop in a certain way, however i believe the benefits of being able to pick up any Ruby project and understand the structure straight away is defiantly a win :) I also like the way it encourages the separation of the dev, test and production environments. My only worry is its performance issues, ability to create an n-tier architecture and how it is not fully support the Microsoft platform which could be a show stopper for some companies heavily tied to MS technologies. I think it could be great to quickly knock something up in a virtual machine though :)

Next I went to session called 'But it works on my PC! or continuous integration to improve software quality' by Richard Fennell. This was a great session that introduced you to the great mindset of continuous integration that I am totally a fan of and I'm currently trying to implement myself. He demoed Cruise Control which looks like a fantastic open source piece of software which with little configuration will do a great job of handling your automated builds and testing. It works well the MS Source Safe but he also showed you how to setup automated builds in TFS but this looked a little more clunky and not supported out of the box. He mentioned a new TFS plugin for Cruise Control that will give the best of both worlds.

Next was a lunch and time for the groktalks and Park Bench activities. These were great but I think the popularity was underestimated as there were too many people for the area where the speakers were placed. I could hardly see what they were demoing let alone hear what they were saying. I spoke to Mike Taulty whilst one speaker was on and he came up with a game where he would guess what the speakers were saying :) I think next time they should use a bigger area and a mic, I don't think a room would be a good idea as it would be too formal :)

I really liked the Park Bench concept, this is where 4 people sit in front of a gathered crowed and take any questions. If you make a statement of think you have a better answer one of the people on the bench have to get up and let you sit down to say your bit. This really lets everyone get involved and say there bit, a nice community type discussion :)

After lunch I want into the session by Abid Quereshi on an 'Introduction to Aspect Oriented Programming' which was quite in depth and I must admit most of it went over my head - partly because we got some bad seat, I was feeling tired after lunch and that I think he emphasized too much on the theory. However it was a great session and in a nut shell was all around the declarative model of programming which produces cleaner and more coherent code.

The final session was titled 'DataAccess Layers - Convenience vs. Control and Performance?' by Daniel Fisher and was the one session I was really looking forward to. Unfortunately Ed Gibson decided to do his usual FBI talk 5min before the session was going to start - I didn't attend this as I have listened to him twice already this year and once you've heard it once you defiantly don't want to hear him talk about small children again :) Then the projector wouldn't work properly so the session was cut short to about 30 min which means he really had to rush this as it was a shame as it looked like he had a good framework. He did say to email him if you would like a copy of the code, so I might just do that :)

Overall great day though and i look forward to DDD5 :)

They did announce a WebDD day on 3rd of February 2007 which is going to be a similar day focused on web development. Will defiantly be attending this one. They also mentioned that MS will be doing a Vista launch on 19th & 20th January 2007 at Reading so look out for this one as its rumoured they will be giving away some copies of the OS :)

Friday, 10 November 2006

Tech Ed - Unit Testing Best Practices with VSTS 2005

Went to a lecture by Mark Seeman (who is a senior MS Consultant) about Unit Testing with VSTS. This was a good lecture as an introduction to unit testing as a concept as well as what VSTS gives us out of the box.

He started off by giving his opinion of a unit being a whole assembly, so he believes that we should be thinking of testing an assembly as a whole, but always abstract away from any volatile dependencies such as other changing components or db. Interestingly he was very adamant that we only test the public interface of the component. After explaining his reasons it really gave me a much better picture of what exactly the aim of the game is :). We are really setting out to test the component from a black box aspect and test the contract.

I really liked the agile type testing that he demoed where you create a test and then build the code to meet it, this really gives you a clear sense of a goal and will keep you from going off on a tangent :)

With VSTS he showed us how we can create a test project (and he recommends a test project for each component you test) and then create test methods within this which form our actual tests. We use a declarative TestMethod attribute to the methods to let VS know that the method is a test. Within the methods we can use the assert object to test the results of calls etc. by comparing our expected result with the actual result. When we build up our tests and run them we can use the test manager to check our results and the code coverage tool to see how much of our code we have tested.

He mentioned the following best practices:

  • Always keep tests simple.
  • Always aim to test all your code by aiming for code coverage of around 90%.
  • All logic should be in components so they can be tested, don’t put any login in the UI.
  • Test cases must be independent (should setup and clean down tests)
  • Test cases must be deterministic (you should not do things like create random values)
  • Reproduce bugs as test cases
  • Place tests in separate projects
  • Have a test project per test target
  • Use source control on test projects

Thursday, 9 November 2006

Tech Ed - Asynchronous ASP.NET Programming

Went to a lecture by Jeff Prosise about Asynchronous ASP.NET Programming which was really interesting. The first thing to note is that this subject is really under documented considering its such an important architecture to use as it can allow you to scale your site.

He explained that when IIS receives an ASP.NET requests it is passed to the worker process, which then allocates it a worker thread from its managed pool of available threads. This thread will remain with the request for its entire lifetime. The worker process also manages an IO thread pool for allocating to any processes that require to carry out any IO.

As there is a finite number of worker process threads that can serve requests it is possible for a busy site to become saturated with requests that cannot be served and clients will start to receive 503 errors. If this occurs we need to scale out the site so serve more requests. One way of doing this is buying more hardware, but the better option is to write our code to utilise the thread by writing asynchronous code. If our code is asynchronous the worker thread can return to the pool to serve more requests whilst we wait for any long running actions such as IO or db actions to occur.

He showed us a couple of ways to make our ASP.NET pages asynchronous, they both involved setting the Async attribute to true in our page directive and then either do the following:
Call AddOnPreRenderCompleteAsync in the page load to register our two Begin and End delegates which can then be used in the page to do the long running process.
or
Create a PageAsyncTask delegate that contains our two Begin and End delegates and register this with the RegisterAsyncTask. This method has the advantage of being able to maintain the thread context, create many tasks, and have a timeout value.

The Async delegates will be called just after the preRender event.

We can use ADO.NET BeginExecuteReader to return the IAsyncResult object to pass up to the return of BeginAsyncOperation method. We also have to complete the EndAsyncResult.

I think if we do make all of our IO methos asynchronous we could really improve the scaleability of our sites – I certainly we be pushing to get some of these changes included in the next releases of my sites :)

He then spoke about creating http handlers which are just classes that adhere to the IHttpHandler object. You can register these with specific file types (not that useful) or create a ashx file with a webhandler directive and ASP.NET will automatically use this object when it is requested by the client. Using this instead of a classic aspx file is great for requests that will not be returning form/asp.net type data such as images as it does not have all the overhead of the pipeline that a aspx request moves through.

He showed us a demo of using a ashx object to return pictures by having a normal img tag on a page that had its src set to navigate to the ashx file with a set of params. When the page renders it calls off to the ashx file which returns the graphic without having to go through the same pipeline that a aspx page would have had to. This results is a much quicker response for the client.

He explained that by default an http handler is synchronous but we can make them asynchronous by conforming to IHttpAsyncHandler instead. You just have to have an empty ProcessRequest method and then fill in the BeginProcessRequest and EndProcessRequest with the work. This is then called asynchronously by ASP.NET.

He showed a good demo of a site pulling back images from virtual earth which render much quicker when using asynchronous calls.

He noted that more improvements could be made by editing the max no of concurrent connections in machine.config.

He also told us to Avoid thread.start Threadpool.queueuserworkitem and Asynchronous delegates and that we should use custom thread pools if necessary as otherwise you can steal a thread from the same pool as the ASP.NET worker process.