Pages

Thursday, 21 May 2009

Oi Microsoft, this IS part of Development!

I've hit a rather frustrating wall whilst implementing my Build Server for TFS 2008. As a company we have licenses for TFS 2008, VS2008 Development Edition and VS2008 Database Edition. Note the absence of VS2008 Test Edition (this is important!).

Our dev branch of source control is using a Continuous Integration model and builds the entire application on every checkin. Marvellous. However, I have been struggling to get the build to run (and report on) Code Coverage as part of the Unit Tests.

Turns out that you need to have VS2008 Test Edition installed on your build server. WTF!? Firstly, why should I need any client-side applications installed on my server for it to work (you need VS2008 Developer Edition to run Unit Tests as part of the build)? Secondly, why is Code Coverage considered part of the Test Edition? As a developer, a core part to producing good software is Unit Testing - which is worthless without a measure of Code Coverage!

Come on Microsoft. You've got to give us proper tools if you want us to continue developing for your platforms. Hopefully, life will change with VS2010?

Many thanks to Buck Hodges for responding to my emails and helping clarify the situation.

Session Availability in ASP.Net MVC

We are in the process of porting one of our Web Forms apps to ASP.Net MVC. This is just something we stumbled upon...

this.Session is null in a Controller's constructor.

Not a huge issue as you can use a Lazy Loading Pattern to circumvent it. It does raise the question of 'why?' though. The MVC (or Routing) framework is responsible for newing-up your Controllers to handle requests. Why couldn't Session be spun up prior to this?

Tuesday, 5 May 2009

LINQ to SQL only goes so far.

I have just finished re-writing my ailing photography website. I have taken the opportunity to write it afresh using ASP.Net MVC and LINQ to SQL. Whilst the latter is hugely more sensible than programming against a database it did highlight a flaw quite early on.

'Entities' in LINQ to SQL (i.e. database tables / views) are connected to each other via Associations. These map 1-1 with the Relationships in your database. Unfortunately, you can't customise these objects thus denying the developer and means to filter entities. Example:

I have 2 main entities in my application: Albums and Photos. An Album can contain many Photos and a Photo must be part of one, and only one, Album. I then added an IsExcluded property to the Photo entity. Unfortunately, I can't set the Association between the 2 to recognise this filter.

Solution 1: Create a new View called 'IncludedPhotos' and use that in the domain model.
Solution 2: Move to LINQ to Entities.

Friday, 6 March 2009

Securing Multiple Sub Domains in IIS 7 with Wildcard SSL

This used to be a real pain in IIS 6.0 but it's gotten a lot easier in IIS 7.

Let's say you set up a web server with the following sites...
  • www.site.com
  • test.site.com
You could bind each individual site to a specific IP Address but this can be expensive and simply doesn't scale. What you should be doing is using Host Headers to help IIS differentiate requests for the different end-points. For a good overview of how to do this take a look at Setting Host Headers in IIS 6.0.

Now, you can do exactly the same thing with https - but there's no UI for it. Possibly the most requested feature hasn't made it into IIS 7. Amazing!

So, here's what to do...
  1. Add a new binding for the web site. Set it to be https, keep the default port and choose the SSL Certificate from the dropdown.
  2. Open <$System32>/inetsrv/Config/applicationHost.xml.
  3. Search for the host header for that site.
  4. Edit the https binding by appending the host header (it follows the same pattern as the http entry.

Friday, 27 February 2009

"We Don't Have Time to Implement Scrum!"

This is a statement I hear frequently in my company from POs and managers. Ken Schwaber recommends that, when starting out with Scrum, not to implement it on a low risk, manageable project 'cos everyone will say "So what? It was gonna work anyway!". Much better to pick a project that is critical and is just about to fail.

Problem with that is that it's nearly impossible to convince the PO to allocate any time to setting up even one sprint. Today I was on the receiving end of "We just need to get it done!". "Well", I said, "when's that gonna be?". "I don't know, but we don't have time for all this planning and stuff.".

On one hand I do understand where the PO is coming from but at what point do you stop and make some space to implement something that should reap massive benefits?

Slightly disappointing, but how can you argue with the PO?

Friday, 20 February 2009

I hate unmanaged code!

Just tried to install yet another application that I would have loved to have used - unfortunately it's written in unmanaged code and they haven't developed the 64bit version yet!

Unless you are writing truly cross-platform apps or you need something that can count in billionths of a millisecond then please use a managed framework.

No-one's impressed that you can 'handle' C++ and you're not fooling anyone that your situation warrants a 'pure' language.

Thursday, 19 February 2009

Acronyms and Abbreviations

Just a list of the common acronyms I'll be using in posts.