Code Behind: CodeFairway.NET

Written on October 03, 2005

As you may already know, I'm the developer behind CodeFairway.NET (If you want to know *what* CodeFairway.NET is, just click here).

In this blog post I will introduce you to the architecture and techniques used on CodeFairway.NET (CFW).

The architecture of CFW looks like this:

As you can see, CFW is developed as a three tier application on top of the .NET Framework 1.1 using ASP.NET 1.1, C# and ASP.NET Web Services (which in turn are using WSE).

Data Sources
All application data is stored in a SQL Server 2000 database or alternatively a Microsoft Access 2003 database file -- you can even use ODBC.

Data Access Logic Components
Data Access Logic Components are implemented using the Microsoft PAG Application Blocks for Data Access. Those components themselves are being accessed by a Data Access Factory (Factory Pattern) allowing it to switch easily between Microsoft SQL Server 2000 (or MSDE) and Microsoft Access or even ODBC.

To show you how easy it can be done, here's a screenshot of the CFW Data Access configuration page:

The only setting you have to change is the DataProviderType, which can be "sqlserver", "oledb" or "odbc". Depending on this, you have to provide the corresponding connection string -- that's all.

Data Access is using Typed DataSets to ensure that strongly typed data is passed into and out of the database layer.

Business Components and Business Entities
To build an application whose components are reusable and scaleable, CFW's Business Logic Layer is implemented using custom classes and collections managing the data being read from and stored into the Data Access Layer. This also allows isolating data/logic and design in the UI Components (MVC Pattern) or to switch the UI from WebForms to e.g. console or being used by a Web service without implementing the whole stuff again and again.

For example there's a custom class that represents the Golfer object. This class also has methods to verify the login credentials against the data being stored in the data source or for disabling the golfer (independent who's disabling the golfer: himself or the referees).

UI Components
As mentioned before, the CFW's UI is implemented using ASP.NET 1.1. Since ASP.NET 1.1 does not provide an approach for Master Pages, I have implemented my own using ASP.NET User Controls, which allows you the usage of the Visual Studio Designer to design your pages.

One feature of this Master Pages approach is that you can specify additional CSS files for each page -- this allows you to use different CSS files on different pages even though they reference the same template file.

The title of each page also could be easily changed by using attributes in the .aspx-file, including the reference to the master page file. You can also assign a theme image for each page. This is shown on the top right (at the current theme/layout) of each page.

Another enhancement is the implementation of XHTML 1.1 Strict (although the referees don't make use of it when declaring the hole rules ;-)) to ASP.NET 1.1, which is not supported out of the box.

To be able to change the whole site's content easily (localization the main driving issue), I've integrated a small content management system (CMS) which stores and retrieves the page content from the data source. Of course you can add new pages and delete unused pages:

Service Interfaces Tee offs submitted by the golfers are rated by the referees (each hole can have different referees). Each referee is notified by Email after each new tee off (if this is activated through the configuration file). After this notification the referee can download the tee file and run the unit tests against it. If the unit tests succeeded, the referee rates the hole to "on the green", otherwise to "bunker":

Because of the huge amount of tee offs (the number at the MVP Summit tournament was in excess of 120 in only two days produced by as few as 13 golfers) being played in a tournament this job can become a fulltime job ;-) To avoid this, I've implemented a Web service that allows the referees to automate this job by just starting a referee client console application that looks for new tee offs, downloads them and run's the unit test against them. And of course, the tee offs are being rated depending on the results of the unit test:

CodeFairway.NET latest features
For the MVP Summit 2005 tournament that finished just recently we were able to present a feature being planned and partially implemented from the beginning of CFW: Internationalization. This means CFW can be configured to display all content in every language you want it to display. The whole translation information is stored in one file. So you can easily share your language file with others or use their translations.

Internationalization does not only mean that you translate the whole content, but it also means that you adjust the time formats et cetera. And we (this means: Chris) wanted to be able to run CFW in specific time zones (the test-hole for this was called "time zone disaster" ;-)).

Another feature which is new and available since a few days is the Account management that allows the golfer to update her user information like the name, Email and password. She can also delete her account, if she no longer wants to participate in upcoming tournaments:

CodeFairway.NET for your community?
You want to run a CFW instance for your .NET community? No problem -- just drop Chris a line. If you're not sure if this is the right thing for you, give me another chance to whet your appetite by showing you some more screenshots of the CFW administration:

This is the green keeper's dashboard. It allows you to create and modify the hole rules as well as the tee off management (I showed that already).

Modifying the rules... no tournament so far wasn't in need for additional clarification after it started.

The golfers' page gives you an overview of all golfers and allows you to disable a golfer or to re-activate a golfer's account being deleted by mistake. If you're looking for a specific golfer, just search for him by name or Email.

To reiterate my point, CFW is easy to configure - just switch to the configuration page and modify the desired setting.

In closing, should you be interested in running a fairway for your community: you don't have to worry about hosting CFW: we can run your CodeFairway.NET instance on our server, the advantage being that you two seasoned administrators: myself and Christoph. Needless to say that this offer is priceless.

So if you are interested in being the host for your community, get in touch with Chris. .NET Golf is very popular: currently, Microsoft Austria is using our German fairway to play a MSDN Connection tournament. Mario just announced it (English).