Beginning .Net Framework

1 view
Skip to first unread message

Amod

unread,
Jun 16, 2006, 12:12:08 AM6/16/06
to ALLABOUTDOTNET
The Microsoft .NET Framework
--------------------------------------------------------
The Microsoft .NET Framework is a computing model that makes things
easier for application development for the distributed environment of
the Internet. The key components of the .NET Framework are the CLR and
the .NET Framework class library. The overall architecture of the .NET
Framework is shown in the following figure.
The .NET Framework consists of the Common Language Runtime (CLR), .NET
Framework class library, Common Type System, Windows Forms, web forms,
web services, Common Language Specification, .NET-compliant languages,
and ADO.NET.

Assemblies
--------------------------------------------------------
Assemblies are the building blocks of .NET Framework applications. In
the CLR, assemblies are the basic unit for deployment, version control,
and security permissions. An assembly is a grouping of types and
resources that form a logical unit of functionality. Assemblies provide
a solution to "DLL Hell" problems caused by versioning issues in
traditional component-based applications such as COM. They do a great
job of simplifying application maintenance and deployment.
Logically, an assembly consists of four elements:
· Type metadata is binary information containing complete details
about the code module and all the types within it. During the execution
of the code, the runtime loads metadata into memory and references it
to explore the information about the code's classes, members,
inheritance, and so on. Metadata is central to other features such as
the debugger and IntelliSense in Visual Studio .NET.
· Microsoft Intermediate Language (MSIL) code that implements the
types and is eventually just-in-time compiled by the CLR and executed
natively on the CPU.
· The assembly manifest encloses assembly metadata. Assemblies are
self-describing via the manifest, which is an integral part of every
assembly. The manifest explains how the elements in the assembly relate
to each other and to external elements.
· An optional set of resources such as bitmaps.
The .NET Framework is a managed, type safe, multi-language environment
for application development and execution. The .NET Framework consists
of the Common Language Runtime(CLR), which acts as an agent (manages
code at execution time) and provides many of the core services such as
memory management, thread management etc. for the .NET base class
library, which exposes a set of predefined classes to assist
application development. The Common Language Specification (CLS)
defines a minimum set of standards that all languages using the .NET
Framework have to support, and the Common Type System (CTS) ensures
type compatibility between components developed in different languages.


The Common Language Runtime (CLR), the Common Type System (CTS), and
the Common Language Specification (CLS)
------------------------------------------------------------------------------------------------------------

The .NET Framework provides a runtime environment called the Common
Language Runtime or CLR (similar to the Java Virtual Machine or JVM in
Java), which handles the execution of code and provides useful services
for the implementation of the program.
The CLR is conceptually similar to a Java Virtual Machine (JVM), with a
few key differences. When the program runs, the JVM interprets Java
Byte Codes every time, but the CLR compiles applications the first time
it runs into native machine code, and then executes these compile
descriptions on succeeding invocations.
In the initial execution of a method, the CLR carries out the
verifications (Types are verified; Subscripts are verified to be in
range; unsafe casts and un-initialized variables are prevented) and
then compiles the method into native code. Moreover, the CLR will
support any language compiler intended for the .NET Platform.
CLR takes care of code management at program execution and provides
various beneficial services such as memory management, thread
management, security management, code verification, compilation, and
other system services. The managed code that targets CLR benefits from
useful features such as cross-language integration, cross-language
exception handling, versioning, enhanced security, deployment support,
and debugging.
During compilation, a source code of any .NET-compliant language is
converted to Intermediate Language code, or IL (officially called
Microsoft Intermediate Language, or MSIL) by the compiler, and then the
IL code (conceptually similar to Java bytecode) is converted to native
code using the just-in-time (JIT) compiler during the runtime.

The Runtime Execution Model
--------------------------------------------------------
Code that targets the Common Language Runtime is said to be managed
code; otherwise, it's said to be unmanaged code. The CLR services
include the following:
· Code management (loading and execution)
· Automatic memory management through garbage collection
· Enforcing strict type safety
· Confirmation of type safety
· Translation of IL to native code
· Access to metadata
· Exception handling, including cross-language exceptions
· Interoperation between managed code and unmanaged code such as COM
objects and preexisting DLLs
· Profiling and debugging services
· Simplified deployment and versioning
· Thread management
· Code verification and compilation
· Cross-language interoperability

The Common Language Specification (CLS)
--------------------------------------------------------------------------
The Common Language Specification (CLS) is an agreement among language
designers and class library designers to use a common subset of basic
language features that all languages have to follow. If any language
vendors want to make their languages .NET-compliant, they have to
follow the Common Language Specification. The CLS assists in improving
and ensuring language interoperability.

The Common Type System (CTS)
------------------------------------------------------------
In .NET, all objects implicitly derive from a single base class
System.Object. The Common Type System (CTS) is the core part of the CLR
that takes care of cross-language integration. The CTS offers a wide
range of types and operations that are found in many programming
languages. The Common Type System supports two general categories of
types:
· Value types include simple types (char, int, float, etc.), enum
types, and struct types.
· Reference types include class types, interface types, delegate
types, and array types.
The Common Type System performs the following functions:
· Facilitates cross-language integration, type safety, and high
performance code execution.
· Provides an object-oriented model and defines a set of rules that
languages have to follow, ensuring that objects written in different
languages can interrelate with each other.

Cross-language compatibility
----------------------------------------------------------
In .NET, the cross-language compatibility is possible because of CTS
(Offer a set of common data types for use across all .NET compliant
languages and ensures type compatibility) and CLS (Defines a set of
minimum standards that all .NET language compilers must conform to, and
thus ensures language interoperability). During compilation, a source
code of any .NET-compliant language is converted to Intermediate
Language code by the respective language compiler. As all .NET assembly
(EXE or DLL) exists as intermediate language, they can interoperate
between them. All .NET compliant languages use the same data types and
are represented as .NET types only. Therefore whether you are using int
in C# or Integer in Visual Basic .NET, in IL it is represented as
System.Int32.

.NET Framework Class Library
----------------------------------------------------------
The .NET Framework class library is a huge collection of 2,500 reusable
classes, interfaces, and value types. The class library is divided into
various hierarchical namespaces according to functionality so that it's
easily manageable. The System namespace is the root namespace for
fundamental types in the .NET Framework. The .NET Framework base class
library contains the base classes (unified, object-oriented,
hierarchical, and extensible set of classes) that provide many of the
services and objects you need when developing your applications. The
class library is organized into namespaces. Namespaces are nothing but
logical groupings of related classes. For example, the
System.Web.Services namespace consists of the classes that facilitate
you to develop and use Web Services.

.NET Enterprise Servers and .NET My Services
---------------------------------------------------------------------------
Microsoft .NET enterprise servers are a set of infrastructure
applications including Windows 2000, SQL Server, Mobile Information
Server, Internet Security & Acceleration Server, BizTalk Server, and so
on for building, running, operating, and managing XML web services and
applications.
Microsoft's .NET My Services (formerly called Hailstorm) is a set of
S2C (service to consumer) web services providing various utilities. As
Microsoft describes them:
· Microsoft .NET Services provides the building blocks for the
efficient development of user-centric applications.
· These services provide tools to build robust, intuitive user
experiences that create deeper, more valuable customer relationships.
· Businesses can create more valuable web sites and applications for
their customers, and gain operational efficiencies to cut costs and
increase profits.

Automatic Memory Management
---------------------------------------------------------------
>From a programmer's perspective, this is probably the single biggest
benefit of the .NET Framework. No, I'm not kidding. Every project I've
worked on in my long career of DOS and Windows development has suffered
at some point from memory management issues. Proper memory management
is hard. Even very good programmers have difficulty with it. It's
entirely too easy for a small mistake to cause a program to chew up
memory and crash, sometimes bringing the operating system to a
screeching halt in the process.
Programmers understand that they're responsible for releasing any
memory that they allocate, but they're not very good at actually doing
it. In addition, functions that allocate memory as a side effect abound
in the Windows API and in the C runtime library. It's nearly impossible
for a programmer to know all of the rules. Even when the programmer
follows the rules, a small memory leak in a support library can cause
big problems if called enough.
The .NET Framework solves the memory management problems by
implementing a garbage collector that can keep track of allocated
memory references and release the memory when it is no longer
referenced. A large part of what makes this possible is the blazing
speed of today's processors. When you're running a 2 GHz machine, it's
easy to spare a few cycles for memory management. Not that the garbage
collector takes a huge number of cycles--it's incredibly efficient.
The garbage collector isn't perfect and it doesn't solve the problem of
mis-managing other scarce resources (file handles, for example), but it
relieves programmers from having to worry about a huge source of bugs
that trips almost everybody up in other programming environments.
On balance, automatic memory management is a huge win in almost every
situation.
Object Orientation
I'm not one to say that OOP is the answer to all problems, and I
certainly wouldn't qualify as an OOP purist. In addition, the idea of
building the concept of an object into the runtime environment isn't
even especially new: Smalltalk had it 25 years ago. Still, it's a
powerful concept.
By making everything an object at the framework level, the designers
instantly created cross-language portability--something that was
difficult and fragile in the days of C/C++, Visual Basic, Delphi, and
assorted other languages, especially when dealing with different object
models. Now that the object model is the same for all languages, it's
trivial to combine modules written in C#, C++, Visual Basic, COBOL,
FORTRAN, and many other languages.

Reply all
Reply to author
Forward
0 new messages