Pages

Tuesday, July 2, 2013

Avoid rework by understanding the three ASP.NET coding models

Changing your application’s architecture midstream can be extraordinarily time-consuming. If you’re using Microsoft’s .NET framework for your server-side solution, there are many options to choose from, and you need to get certain decisions right the first time. We’ve found that there are generally three basic ways in ASP.NET to perform any given task. To help describe how to match these three approaches to meet your needs, we’ve come up with three hypothetical characters: Classy Clyde, Terry O’Toole, and Big Bob. Let’s see how to best match these developers with their coding architecture needs.

The classic .NET way: Single-file pages
Classy Clyde works in a company that’s using ASP and has never had the time or budget to switch to NET. They want to make the switch because of .NET’s performance benefits. However, they need to make the conversion as quickly and cheaply as possible.

Our recommendation:
  1. Convert ASP pages to ASPX pages with minimal changes (what Microsoft calls the single-file model) by renaming the extension and adding the files to a .NET project.
  2. Make sure to change any VBScript syntax to VB .NET (e.g., all procedure calls require parentheses now).
  3. Gradually use more .NET features (such as code-behind pages) as time permits.
The tool-oriented way: Web Forms designer
Terry O’Toole has a different need. She’s also working on a tight timeline and budget. But she’s starting from scratch, building an intranet site using a team of people who either lack experience on the server-side end or on the web end.

Our recommendation:
  1. Use the Web Forms designer to drag and drop controls, which facilitates quick development.
  2. Use .NET’s code-behind model to best take advantage of the existing skill level of your employees. People with web design skills can work on the ASXP page, and VB developers can focus on the code-behind pages.

The do-it-yourself way: Bypassing ASPX
Finally, meet Big Bob. He needs his web application to be highly configurable, so that the same application has a very different user interface when different clients use it. Furthermore, he’s trying to gain an edge in the marketplace, so he doesn’t want his application to look like the typical ASP.NET app.

Our recommendation:
  1. Bypass the ASPX page and put everything in the code-behind pages.
  2. Use the inheritance concept to organize code-behind pages.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.