Choosing an application type
When building a new application one of the important choices you are faced with making is the type of application it will be. In some cases there won't be much of a decision to make but it is always important to carefully consider the implications of the project type you are choosing.
Common application types:
An ASP.NET web application is a server based application that is hosted in a browser on the client. Because the client in a web application is a browser this type of application has inherent cross platform capabilities and will be usable by the largest number of users. This is by far the most common application type in the IT industry and should be the first type of project you consider - if you are considering a client application please see the below guide to try and help you decide which technology is appropriate, when in doubt a web application is preferred over a client application.
- User interface is platform independent
- Supported on mobile devices
- The quality of the mobile experience will be dependent on what extent the site is optimized for mobile use
- Supports AJAX for a interactive and responsive UI that can rival that of an RIA application
- Simple web based deployment & maintenance
- More difficult to provide extremely rich UI
- Supports connected only scenarios (no off-line)
If a web application is the right type for you project you have yet another choice to make: Webforms or MVC? Looking at recent trends MVC is the preferred web application style as it helps to enforce a better architectural style.
Until recently webforms was the only out-of-box ASP.NET application type, webforms implements a post-back style of communication where page state is stored in a hidden field and requires posting back for actions to occur on the server. Using the webforms approach requires that you give up control over certain application behaviors and work with how the framework dictates. If you use this style of web application consider using a presentational pattern such as MVP to promote separation and testing.
ASP.NET MVC is a framework for developing highly testable and maintainable web applications by leveraging the Model-View-Controller (MVC) pattern. The framework encourages you to maintain a clear separation of concerns among the responsibilities of the application – the UI logic using the view, user-input handling using the controller, and the domain logic using the model. ASP.NET MVC applications are easily testable using techniques such as test-driven development (TDD). ASP.NET MVC will give you full control over your application and allow you to optimize performance where not possible/manageable in a webforms scenario. ASP.NET MVC also makes use of url routing to allow you much greater control over your URLs (great for SEO). Using the MVC project type is the preferred choice unless you have a compelling reason to stay with the webform application type.
Rich Client Application
Rich client applications are ones that install and run from the client machine, they are also known as fat client applications. They impose the greatest set of requirements on the client and are platform specific, but allow for the richest programming experience on the client that inclues the full power of the .net framework. Please see below for help in deciding between a web application and a client application.
- Ability to leverage client resources (i.e. file system, registry, etc.)
- Highly dynamic and responsive interaction
- Supports disconnected (off-line) scenarios
- Client code and server code both run on the .net platform
- Application runs locally, requires the client to have the matching version of the .net framework installed
- No mobile clients
- Complicated deployment
If a full client application is the right type of application for your project you have another decision to make: Winforms or WPF? In current scenario WPF is the recommended type for a client application, this follows Microsoft's general direction on client application technology. WPF also has much wider support for graphics capabilities. Winforms should be considered as an option if you have considerable experience in the technology or are developing a new application as part of a suite of existing applications that is already built using winforms technology.
Rich Internet Application
A rich internet application is one that is delivered via the browser but acts more like a traditional client application. The most common form of a RIA application is going to be one that utilizes a browser plugin such as Adobe Flash or Microsoft SilverLight. At this time this type of application is not common or recommended in most scenarios.
A service application is one that exposes its functionality to clients without the use of a UI, rather it responds to message based requests coming from clients on potentially different platforms. Service applications can be optimized for .net to .net communication through the use of WCF. A service project is common to have in both web and client application solutions to facilitate communication from the client to the server.
A mobile application is one that is designed to target mobile clients rather than a traditional client. There are several different approaches to mobile applications, they can be native(built for a specific platform, i.e. iOS or Android), hybrid (using a tool like PhoneGap) or built using HTML5. It is also possible to build applications that are "mobile friendly", for this type of application favor using an ASP.NET MVC web application and create targeted mobile views for any UI screens that need to look/function differently on a mobile device. Mobile Web Frameworks
A console application is one that is intended to be run from the command line, its parameters are typically passed to it at startup time and it is then allowed to run to completion. Choose this application type if you have a job that needs to run unattended, the most common use of this type of application.
A shared assembly is a project whose output is a .net library that is intended to be used by more than one project. A typical solution may contain several different assembly projects but you could also create a stand-alone assembly solution if the resulting assembly was intded to be shared across multiple solutions. Favor this type of project if you need to create an assembly that will be used by multiple different solutions and want to be able to test the assembly in isolation of any other projects.
Questions to help deciding between a web and client application
Q.How many users do you have?
A.Client apps tend to be better suited to lower numbers of users.
Q.What is the location of the user base?
A.If the users are external to your organisation creating a web application would allow for cross platform support and not have heavy client requirements.
Q.Does the application have any mobile requirements?
A.Client apps don't work on a mobile device (at least not directly), if you have any mobile requirements you will need to use a standard web application (with potentially optimized 'views') or a targeted mobile solution.
Q.Are there any off-line requirements?
A.Web applications don't work in an off-line mode, for full support of this a client app is required.
Q.Does your application have complicated state requirements?
A.The more complicated your state requirements are the more compelling a full client application is.
Web apps can support state but will not perform as well as the amount of state increases.
Q.How complex are the screens?
A.As the complexity of screens increases so does the time to create and maintain them, using a client application for apps with highly complex screens would potentially be easier than a web application.