Goals of the .NET Framework


The .NET Framework was designed with four main goals in mind:

  • Unify programming models.

  • Be factored and extensible.

  • Integrate with Web standards and practices.

  • Make development simpler.

Unify Programming Models

The .NET Framework unifies various programming models. In the early 1990s, it was common to develop against flat, C-style APIs ”that is, APIs that used few object-oriented concepts. The user interface (UI) handled Windows messages via a function pointer to a global function ( WinProc ) that contained a large and cumbersome switch statement. While this approach worked, it was not particularly productive or easy. Over time, various programming models created on top of the Windows API have emerged to address these problems.

In the early 1990s, productivity tools such as Visual Basic, Delphi, and PowerBuilder introduced the rapid application development (RAD) paradigm. Visual Basic, for example, introduced a level of abstraction over the Win32 APIs. The common programming model with this language is to instantiate a form, drag components onto the form, double-click on components , and write event handlers for them. This model simplifies the process of building a common line of business applications, but it is not extensible; using a component that is not specifically wrapped for Visual Basic is not possible. Under this view, the system is a black box, and it is not possible to "see into it" or extend it.

With the popularity of C++ in the 1990s came a series of more object-oriented approaches to programming models, such as the Microsoft Foundation Classes (MFC). The key concept underlying these programming models is subtyping. You subtype from an existing monolithic, object-oriented framework and extend the functionality to match the functionality required in your application. While this model does offer more power and expressiveness , it does not really match the ease or productivity of the RAD-style composition model.

The growth of the Web in 1990s led to the emergence of server-side Hypertext Markup Language (HTML) generation in application models such as Application Server Pages (ASP) and Java Server Pages (JSP). This model promotes writing stateless code to generate the UI in the form of HTML, Dynamic HTML (DHTML), and script that is rendered on the client. It rarely takes advantage of good development or design tools and, as mentioned earlier, suffers from interleaving of code and the UI.

One problem with the current state of development is that the developer's choice of a programming model often also dictates the choice of a programming language and the libraries that can be used (and vice versa). Skilled MFC developers cannot easily write code in ASP, for example, because their skills do not translate into the different paradigm. Likewise, if developers are familiar with a RAD model, little of that knowledge transfers to a C/C++-style API.

The models also provide inconsistent functionality. Each offers slightly different solutions to a number of problems that are actually common to all of the models. For example, file I/O, string formatting, security, and threading are exposed in different ways in each model. As a consequence, knowing how they work in one context does not help the developer understand how to work with them in another context.

The .NET Framework was designed to unify these disparate programming models. Its core concepts are applicable regardless of which application model is being built. For instance, Web developers are right at home with ASP.NET and can easily move to building a "smart" client part of their application with the same set of underlying technologies. Likewise, traditional Visual Basic developers of business applications can leverage the skills they already know to create Web-based applications. The choice of programming language no longer dictates the range of options available. Instead, the .NET Framework allows developers to choose the combination of programming language and application architecture that best solves the problem at hand.

Be Factored and Extensible

The .NET Framework is not a closed system. It is factored (that is, broken down into distinct, meaningful units) and extensible, thereby enabling a high degree of customization and specialization. Almost any class that exists in the framework is available for extension using inheritance. Unlike in COM, you actually extend the class itself ”not a wrapper around some external functionality.

The extensibility of the .NET Framework also supports plug-and-play components and subsystems. For example, the ASP.NET system offers a pluggable model where users can add their own extensions to the underlying system. Developers can plug in their own user authentication modules by inheriting from the base classes provided by the framework, then provide customized functionality in the descendant class that overrides the standard functionality.

Object-oriented design concepts permeate the Framework Class Library. Because the runtime environment supports multiple languages at its core, cross-language inheritance is not merely possible but mandatory. It does not matter which language the developer uses to extend the framework, write components, or implement applications. Common functionality is exposed as base classes with shared and specialized members. Shared utility methods are exposed as nonvirtual members that allow for meaningful reuse of code. Defined points of specialization are exposed as virtual methods but given meaningful default implementations so that subtypes have to specialize only in desired areas. Many of the libraries in the .NET Framework expose system resources such as windows handles ( HWnds ) and file handles. In such cases, the underlying resource is exposed to provide a "back door" for the case in which one particular feature is not exposed in the encapsulation. Tailoring the operation becomes possible even if the library does not expose that functionality.

Integrate with Web Standards and Practices

Web standards and practices are deeply integrated into the .NET Framework. HTML, XML, and SOAP are at its foundation. By adhering to these standards, the .NET Framework provides a transition path from traditional client-server applications (which are not Internet-ready) into loosely coupled , stateless applications (which are Internet-ready).

The platform addresses some of the key problems with Web application development today. With ASP and JSP, developers writing the code that runs the Web site and designers creating the look and feel of the Web site must share the same source file. That is, presentation and business logic are combined in HTML, resulting in a source of potential conflict between developers and designers. The .NET Framework addresses this problem by allowing the application code and the HTML to be maintained as separate entities.

XML is a core concept in the .NET Framework. In addition to offering a Document Object Model (DOM)-level XML reader and writer that comply with the World Wide Web Consortium's (W3C) standards, the .NET Framework supports a higher-level way to read and write XML called XML serialization. XML serialization allows programmers to interact with XML as a set of objects, elements, and attributes represented as properties. The common data format through the .NET Framework is XML. The configuration store, object serialization, and security policy settings are all stored in XML formats. SOAP is the standard for machine-to-machine communications. Likewise, XML is the foundation for Web Services, the model for programmatically accessing Web-based resources.

The .NET Framework offers a well-defined asynchronous execution pattern and a high-performance thread pool implementation. Web Services, network connections, file I/O, and method calls through asynchronous delegate invocations support this pattern fully. In addition, the ASP.NET application model, including Web Services, offers support for a stateless programming model. Such a model enables the developer to scale out Web-based applications from one machine to a large Web farm of machines without changing the applications.

Make Development Simpler

The Framework Class Library was designed to facilitate the process of building applications. It enables developers to more easily write full-featured applications by "up-leveling" the platform ”that is, by increasing the level of abstraction. The library design focuses on the developer or, more accurately, on the tasks the developer is trying to accomplish rather than inherent limitations of the underlying technology.

For example, in Win32, certain window properties cannot be set after a window is created, whereas other properties can be changed at any time. Presumably, this inconsistency is a by-product of how the Windows operating system itself is implemented. However, the developer need not be limited by this implementation detail. The .NET Framework's encapsulation of this API (in Windows Forms) is designed around what the developer needs to do rather than the implementation detail. In Windows Forms, you can set any property at any time. The Framework Class Library does the work "under the covers" to re-create the window handles as needed, but the developer never needs to know about these details.

The .NET Framework can be expressive in its design because it takes advantage of the rich support of the underlying execution engine. It expresses functionality on types using three different constructs: properties, events, and methods. Each construct denotes its own set of information and usage patterns to the developer:

  • Properties express a logical backing store. Developers understand that they can treat these elements just like data members (fields) in terms of their performance characteristics and semantics.

  • Events indicate that the developer can register a method to be called back when an event occurs.

  • Methods express operations of a type. For example, a value type indicates to the developer that it will behave very much like the int or double type in a particular programming language. It will be passed by value and, by default, allocated on the stack. Similarly, developers understand that types that subtype System.Attribute should be used as custom metadata annotations in a declarative way. Enumerations are a special kind of value type used to represent named integral constants (such as the days of the week).



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net