1. Introduction
The PDF of this document is available |HERE|.
The examples in this document are available |HERE|.
We want to write a .NET application that allows a user to simulate payroll calculations for child care providers at the "Maison de la petite enfance" association in a municipality. We will focus as much on the organization of the application’s .NET code as on the code itself.
The final application, which we will call [SimuPaie], will have the following three-tier structure:
![]() |
- The [1-DAO] layer (DAO = Data Access Object) will handle data access. The data will be stored in a database.
- The [2-business] layer will handle the business logic of the application, namely payroll calculation.
- The [3-ui] layer (ui = User Interface) will handle the presentation of data to the user and the execution of user requests. We refer to the set of modules performing this function as [Application]. It serves as the user interface.
- The three layers will be made independent through the use of .NET interfaces
- The integration of the different layers will be handled by Spring IoC
The processing of a client request follows these steps:
- The client makes a request to the application.
- The application processes this request. To do so, it may need assistance from the [business] layer, which itself may need the [DAO] layer if data needs to be exchanged with the database. The application receives a response from the [business] layer.
- Based on this response, it sends the appropriate view (= the response) to the client.
The interface presented to the user can take various forms:
- a console application: in this case, the view is a series of lines of text.
- a Windows GUI application: in this case, the view is a Windows window
- a web application: in this case, the view is an HTML page
- ...
We will write different versions of this application:
- an ASP.NET version containing a single form and built with a single-layer architecture.
- a version identical to the previous one but with Ajax extensions
- an ASP.NET version based on a three-tier architecture where the data access layer is implemented using the NHibernate framework. It will still have the single form from version 1.
- a version 4 ASP.NET multi-view, single-page application with the three-tier architecture of version 3.
- The server-side of a client/server application where the server is implemented as a web service based on the layered architecture of version 3.
- The client-side of the previous client/server application, implemented using an ASP.NET layer.
- A multi-view, multi-page ASP.NET version 7 with the three-tier architecture of version 3.
- A multi-view, multi-page ASP.NET 8 client version of the Version 5 web service.
- A multi-view, multi-page ASP.NET 9 version with the three-tier architecture of version 3, where the data access layer is implemented using Spring classes that facilitate the use of the NHibernate framework.
- A version 10 implemented in FLEX and serving as a client for the version 5 web service.
Prerequisites
On a scale of [beginner-intermediate-advanced], this document falls into the [intermediate] category. Understanding it requires various prerequisites that can be found in some of the documents I have written:
- ASP.NET Programming [Web Development with ASP.NET 1.1];
- C# 2008: [Learning C# Version 3.0 with the .NET Framework 3.5]: classes, interfaces, inheritance, polymorphism
- [Spring IoC], available at [Spring IoC for .NET]. Covers the basics of Inversion of Control (IoC) or Dependency Injection (DI) in the Spring.NET framework [http://www.springframework.net].
- [Building a Three-Tier Web Application with Spring and VB.NET], available at the URL [Creating a Three-Tier Web Application with Spring.NET and VB.NET]. This course presents a simplified web-based product purchasing application. Its three-tier architecture implements the MVC pattern.
Reading recommendations are sometimes provided at the beginning of paragraphs in this document. They reference the preceding documents.
Tools
The tools used in this case study are freely available on the web. They are as follows:
- Visual C# 2008, Visual Web Developer Express 2008, SQL Server Express 2005 available at the URL [http://www.microsoft.com/express/downloads/].
- Spring IoC for instantiating the services required by the application, available at [http://www.springframework.net/]—see also [3]
- NHibernate for the DBMS data access layer [http://sourceforge.net/projects/nhibernate/]
- NUnit: [http://www.nunit.org] for unit testing.
