www.bernsen.nl

Microsoft Technology in Bubbles game

This pages describes the technology which was used to create the little Bubbles Game at my website.

I first build the game in 2000 as a little experiment, it used a java applet for the game itself and I used classic ASP, DHTML, Javascript, VB6, ADO and MS Access for the highscore pages, etc. It was developed using JDK v1.1 and Visual Interdev v6.0. Well today that's very lame stuff and in Februari 2008 I decided to upgrade it to the latest state-of-the-art Microsoft Technoly since VS2008, .NET Framework v3.5 and Silverlight were just released.

In October 2009 I upgraded to ASP.NET MVC, jQuery, Unity and Unit testing using Rhino Mocks and WatiN.

Site history

The rest of this page describes a little about the latest technology used to build the game.

Silverlight 4

The game itself is build in Silverlight (the Java applet game is no longer available). I started the game in Silverlight v1.1 Alpha, I did not want to use silverlight v1.0 since it still works with Javascript, javascript is hard to maintain. In March I ported the game to Silverlight 2 beta 1 since it was then just available. A lot of things had changed from 1.1 alpha to 2.0 beta (a lot of new controls are available (e.g. textbox, button), SOAP services can be used instead of JSON and there's a silverlight .NET control). Silverlight 2 supports managed code which is downloaded to the client. So it's just programming C#. It has a small subset of Windows Presentation Foundation (WPF), therefor most of the layout is designed in XAML. On the end of the game you can enter your name and the score will be saved. This is done using a call from Silverlight to a Windows Communication Foundation (WCF) webservice. Then the monthly highscores are shown, this is also done using a call to a WCF webservice. In 2010 I upgraded to Silverlight 4


ASP.NET MVC, jQuery & XHTML

The pages of the website are written in ASP.NET MVC, the website uses some nested masterpages and CSS for the layout. XHTML is generated using ASP.NET MVC and the game pages also contain some unobtrusive javascript using jQuery to do some progressive enhancement on the menu so it uses ajax for the different menu options.

At first I was a little bit sceptic about ASP.NET MVC, because it reminded me of the classic ASP pages but after having worked with it I really like it, it let's you make clean and tidy HTML and doesn't generate as much overhead as ASP.NET which makes it much faster.


LINQ & ADO.NET Entity Framework

At first I started with a Data Access Layer using LINQ to SQL to do the Object Relational Mapping (ORM) to the SQL 2008 database. In December 2008 I ugraded to ADO.NET Enity Framework and LINQ to Entities. ADO.NET Entity Framework provides Object Relational Mapping (ORM), using Entity Framework the mapping between the objects and the database doesn't have to be a 1 to 1 mapping. The same LINQ queries for LINQ to SQL could be reused with LINQ to entities. I played around with a quite a bit of different LINQ to SQL and LINQ to entity contstructions and it's amazing to see how well this gets transformed to SQL. You can see this with the SQL Profiler. Microsoft has really done a great job with this!


Windows Communication Foundation (WCF)

To save the scores at the end of the Silverlight game it uses a WCF webservice to do this. The WCF service is hosted in the same IIS as the website itself. There are some known problems with hosting a WCF service on a server with multiple host headers in IIS (as is the case with my remote hosting provider), for this reason I had to create my own ServiceHostFactory.


.NET Framework v4.5 / C# 2008

Of course I used .NET Framework v4.5 and the C# language to create the game. I tried some new C# 2008 constructions like: Automatic Properties, Object Initializer Syntax and of course LINQ.


Microsoft Enterprise Library

At first for logging and exception handling I used the Microsoft Enterprise Library v3.1 (May 2007). Unfortunately it does not integrate with VS2008 (only with VS2005), in November 2008 I upgraded to Enterprise library v4.1 which supports VS2008 integration.


Unity Application Block

The Unity Application Block is used for building the ASP.NET MVC Controllers and injecting them with a business service for database access.


Visual Studio 2010 Professional

I used VS2010 to build the code. It's nice that I can use one solution with class libraries, unittest projects, a website and silverlight projects. The deployment of the site can be done completely from VS2010. Furthermore VS2010 Professional supports Unit testing (VS2005 Professional did not) and a Test Manager. So I used the Visual Studio QualityTools UnitTestFramework to build unit tests into the solution.


Unit testing

I build unittests for the different parts of the website. I enhanced the unittests using Rhino Mock and WatiN.


Search Engine Optimization Toolkit

I used the Microsoft Search Engine Optimization Toolkit to improve the sites SEO. A very easy tool which can be used from IIS7 upward.


SQL Server 2008 Database

The database is a shared SQL Server 2008 database.


Browsers

I used the following browsers to test the site: Internet Explorer 6, 7 & 8, Mozilla Firefox v3.5 and Google Chrome.


Remote hosting on Windows Server 2008

I use one of the leading hosting providers in the United States to host the website. It is currently hosted on Windows Server 2008 with IIS7. The database is hosted on SQL server 2008.