Popular Posts

Friday, March 13, 2009

5.2 .NET Application Scenarios

5.2 .NET Application Scenarios

Managed code can be used to develop a variety of different kinds of software. First, it is worth mentioning that most existing styles of software can be developed using managed code. This includes console or command-line applications as well as GUI or windowed applications. Here is a list of the types of applications that can be developed using C# or any other language that targets the .NET Framework.

· GUI Applications – Managed applications that present a graphical interface to the user are referred to as Windows Forms applications. These programs can have the typical buttons, menus, drag-and-drop, and other features that are expected from GUI applications.

· Console Applications – Managed code is inherently operating system agnostic. As such, it is necessary that both of the major styles of user interface are supported by managed code. Therefore you can write managed console applications. This can be useful for writing managed versions of control-scripts and other batch-able commands.

· Active Web Applications – Managed code can be used to create web pages that are generated programmatically as the result of running software (as opposed to static html). These applications are referred to as Web Form applications. Web Forms are the managed answer to technologies such as CGI, ISAPI, and JSP. You write your managed code using C# much like a typical application, however it executes on the server side (by a web-server that hosts the CLR, and therefore hosts managed code). This hosting component is called ASP.NET and allows your applications to present their UI as web-pages.

· Web service applications – Web services are software components that perform a task in a distributed manner. In a sense, a web-service is like an active web-page, where the client is another piece of software, rather than a human user using a browser. Web services use standard protocols such as SOAP and XML to communicate any kind of data between machines across the internet. The .NET Framework can easily be used to create and expose web service applications on the Internet. It is also very easy to create web-service client software using C# or any other .NET Language. See www.XMethods.com for an example of the types of objects or algorithms that are exposed as web-services.

· Scripted Components – It is common for major applications such as Microsoft Excel or CodeWrite to include macro languages that make it possible to customize the functionality of the application. In fact some applications or application suites (such as Microsoft Office) have such advanced scripting abilities that you can develop complete applications in their macro environment. Moving forward, managed code will be the vessel for all scripting for applications running on Windows (and hopefully other operating systems as well). The CLR can be hosted in any application whether the application is managed or unmanaged. This allows typical managed code to become the “scripting language” for the application. (Of course with managed code all scripts will be JIT compiled, and execute at full speed, but this is just the icing on the cake). Now if you become comfortable with C# or some other language that targets the .NET Framework, you will already know the macro language for the applications that you use. You can also develop applications that host the .NET Framework so that your applications are scriptable using managed code.

· Other miscellaneous applications – Managed code can be used to develop NT services, legacy ActiveX and COM controls, as well as a handful of other types of applications. However, the really exciting application types are the ones that we covered in the previous bullets.



Figure 5‑2 Managed Code in an Internet-Distributed World

Remember Figure 1‑1? It showed software in a highly distributed environment. Figure 5‑2 takes a cross-section of Figure 1‑1 and describes where managed code fits into the picture.

Regardless of where the application runs, with managed code developers like you and me are able to

· use the programming language that they prefer,

· use objects and components created in other (.NET) languages,

· create a variety of application types using tools with which they are comfortable

· and build on knowledge gained in other, often largely dissimilar, projects because so much of the groundwork is based in the same features (the CLR, managed code, IL, the FCL, etc.).

Let’s dive headlong into a real managed application just for fun.

No comments:

Post a Comment