A New Programming Platform

for RuBoard

Let us look at what we have just discussed from the point of view of .NET as a new programming platform:

  • Code can be validated to prevent unauthorized actions.

  • It is much easier to program than the Win32 API or COM.

  • All or parts of the platform can be implemented on many different kinds of computers (as has been done with Java).

  • All the languages use one class library.

  • Languages can interoperate with each other.

There are several important features to the .NET platform:

  • .NET Framework

  • Common Language Runtime

  • Multiple language development

  • Development tools

.NET Framework

Modern programming relies heavily on reusable code provided in libraries. Object-oriented languages facilitate the creation of class libraries, which are flexible, have a good degree of abstraction, and are extensible by adding new classes and basing new classes on existing ones, "inheriting" existing functionality.

The .NET Framework provides over 2500 classes of reusable code, which can be called by all the .NET languages. The .NET Framework is extensible, and new classes can inherit from existing classes, even those implemented in a different language.

Examples of classes in the .NET Framework include Windows programming, Web programming, database programming, XML, and interoperability with COM and Win32. The .NET Framework is discussed in the next chapter and throughout the rest of the book.

Common Language Runtime

A runtime provides services to executing programs. Traditionally there are different runtimes for different programming environments. Examples of runtimes include the standard C library, MFC, the Visual Basic runtime, and the Java Virtual Machine. The runtime environment provided by .NET is called the Common Language Runtime or CLR.

Managed Code and Data

The CLR provides a set of services to .NET code (including the .NET Framework, which sits on top of the CLR). In order to make use of these services, .NET code has to behave in a predictable fashion, and the CLR has to understand the .NET code. For example, to do runtime checking of array boundaries, all .NET arrays have identical layout. NET code can also be restricted by type safety requirements.

As we will discuss in the next chapter, the restrictions on .NET code are defined in the Common Type System (CTS) and its implementation in the Microsoft Intermediate Language (MSIL or IL). The Common Type System defines the types and operations that are allowed in code running under the CLR. For example, it is the CTS that restricts types to using single implementation inheritance. MSIL code is compiled into the native code of the platform.

.NET applications contain metadata, or descriptions of the code and data in the application. Metadata allows the CLR, for example, to automatically serialize data into a storage.

Code that can use the services of the Common Language Runtime is called managed code.

Managed data is allocated and deallocated automatically. This automatic deallocation is called garbage collection . Garbage collection reduces memory leaks and similar problems.

Microsoft and ECMA

Microsoft has submitted specifications for the C# programming language and core parts of the .NET Framework to the European Computer Manufacturers Association (ECMA) for standardization. The ECMA specification defines the platform-independent Common Language Infrastructure (CLI). The CLR can be thought of as the CLI plus the Base Class Libraries (BCL). The BCL has support for the fundamental types of the CTS such as file I/O, strings, and formatting. Since the CLR is platform dependent, it makes use of the process and memory management models of the underlying operating system.

The ECMA specification defines the Common Intermediate Language (CIL). The ECMA specification allows for CIL to be compiled into native code or interpreted.

Verifiable Code

Managed code can be checked for type safety. Type safe code cannot be subverted. For example, a buffer overwrite cannot corrupt other data structures or programs. You can only enter and leave methods at fixed points, you cannot calculate a memory address and start executing code at an arbitrary point. Security policy can be applied to type safe code. For example, access to certain files or user interface features can be allowed or denied . You can prevent the execution of code from unknown sources.

Not all code that makes use of the facilities of the CLR is necessarily type safe. The canonical example is managed C++. Managed C++ code can make use of CLR facilities such as garbage collection, but cannot be guaranteed to be type safe.

Multiple Language Development

As its name suggests, the CLR supports many programming languages. A "managed code" compiler must be implemented for each language. Microsoft itself has implemented compilers for managed C++, Visual Basic.NET, Jscript, and the new language C#. Well over a dozen other languages are being implemented by third parties, among them COBOL by Fujitsu and Perl by ActiveState. To accommodate the use or creation of .NET data types, however, new syntax often has to be introduced. Nonetheless, programmers do not need to be retrained in a completely new language in order to gain the benefits of .NET. Legacy code can be accessed through the interoperability mechanism.

Development Tools

A practical key to success in software development is a set of effective tools. Microsoft has long provided great tools, including Visual C++ and Visual Basic. With .NET they have combined their development tools into a single integrated environment called Visual Studio.NET.

  • VS.NET provides a very high degree of functionality for creating applications in all the languages supported by .NET.

  • You can do multiple language programming, debugging, and so on.

  • VS.NET has many kinds of designers for forms, databases, and other software elements.

As with the languages themselves , third parties can provide extensions to Visual Studio.NET, creating a seamless development environment for their language that interoperates with the other .NET language. The tool set includes extensive support for building Web applications and Web Services. There is also great support for database application development.

The Importance of Tools

The importance of tools should not be underestimated. Ada, a very powerful programming language, never achieved widespread use. While part of the initial vision was to create a standard Ada Programming Support Environment (APSE), most of the attention was paid to specifying the language, not the APSE. Consequently, Ada never did develop any development environment comparable to that of Visual Studio, Smalltalk, or some of the Java IDEs .

Visual Studio.NET will be highly tuned for productivity, and much training will be available. Microsoft has far more resources to throw at Visual Studio.NET than do smaller vendors in the highly fragmented tools market. Java is highly standardized in the language and API, but tools, which are required for productivity, are not standard.

for RuBoard


Application Development Using C# and .NET
Application Development Using C# and .NET
ISBN: 013093383X
EAN: 2147483647
Year: 2001
Pages: 158

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