Week 1 What is .NET

Download Report

Transcript Week 1 What is .NET

What is .NET
Modified from Microsoft powerpoint
Learning Objectives

By the end you will be able to:
• Understand the reasons for the creation
.NET
• Learn the core goals of the .NET
initiative
• Describe at a high level of detail the
core components of the .NET
Framework.
The Need For .NET

Complexity of Software development
process
•
•
•
•
•
Distributed systems
Development time
Version control & updates (The end to DLL Hell!)
Language Interoperability (Replaces COM Model)
Componentized-based Software Engineering
(Lego-block dev.)
• Security

Making Services available to users
anywhere in the world
The Objectives of .NET



To provide a consistent object-oriented
programming environment whether object code is
stored and executed locally, executed locally but
Internet-distributed, or executed remotely.
To provide a code-execution environment that
minimizes software deployment and versioning
conflicts.
To provide a code-execution environment that
guarantees safe execution of code, including code
created by an unknown or semi-trusted third
party.
The Objectives of .NET (cont.)



To provide a code-execution environment that
eliminates the performance problems of scripted
or interpreted environments.
To make the developer experience consistent
across widely varying types of applications, such
as Windows-based applications and Web-based
applications.
To build all communication on industry standards
to ensure that code based on the .NET
Framework can integrate with any other code.
The Objectives of .NET
(Quick and Dirty Overview)













Consistent programming model
Simplified programming model
Run once, run always
Simplified deployment
Wide platform reach
Programming integration
Simplified code reuse
Automatic memory management
Type safe verification
Rich debugging support
Consistent method failure paradigm
Security
Interoperability
The Implementation of the Goals of
.NET Initiative

The .NET Framework is the real
software product that meets
objectives and requirements of the
.NET initiative
The .NET Framework in Context
Main Components of the .NET
Framework


Common Language Runtime (CLR)
Foundation Class Library (FCL)
Common Language Runtime (CLR)


Considered the foundation of the
.NET Framework
Thought if as an agent that:
• Manages code at runtime, providing
core services as:




Memory management
Thread management
Enforcing strict type safety (CTS)
Code access security
Common Type System


Ensures compatibility between . NET
Types.
All Primitive data types for all .NET
compliant languages are .NET types.
• These types are converted to IL during
the compilation process.
Developer Benefits from the CLR

The CLR provides the following benefits to
developers using .NET:
• Automatic object referencing and garbage
collection. Solves two BIG problems:


Invalid memory references
Memory Leaks
• Accelerated productivity

ALL .NET compliant Languages can access, consume,
and use all features of the .NET framework.
Foundation Class Library (FCL)




An extensive, object-oriented library of classes
(types) that provide the core functionally of .NET.
Tight integration with the CLR
Extensible; you can derive your own types form
existing types.
Common programming tasks are handled
efficiently and logically. Some examples are:
•
•
•
•
•
String management
Data collections
File access
Windows/Web UI And Services
Database connectivity
Specialized Applications

The FCL inherently supports these typical
development scenarios, providing
specialized types for ease of
implementation:
•
•
•
•
•
•
Console Apps
Windows Apps
ASP.NET Apps
Web Apps
XML Web Services
Windows Services
The Structure of a .NET Application



The primary unit of a .NET application is the assembly.
An assembly is a self-describing collection of code,
resources, and metadata.
The assembly manifest stores information about the
contents of an assembly.
• The assembly manifest provides:




Identity information, such as the assembly’s name and version
number
A list of all types exposed by the assembly
A list of other assemblies required by the assembly
A list of code access security instructions, including permissions
required by the assembly and permissions to be denied the
assembly
• Each assembly has one and only one assembly manifest
• The assembly manifest can be contained in its own file or
within one of the assembly’s modules.
The Structure of a .NET Application (cont.)

Types are templates that describe a set of data
encapsulation and functionality.
• There are two kinds of types:




Reference types (classes)
Value types (structures).
Each type is described to the common language runtime in
the assembly manifest.
A type can contain:
• Fields

A field represents storage of a particular type of data.
• Properties

Properties are similar to fields, but properties usually provide some
kind of validation when data is set or retrieved.
• Methods

Methods represent behavior.
Compilation of a .NET Application


When you compile a .NET application, it is
not compiled to binary machine code;
rather, it is converted to IL.
The application consists of one or more
assemblies consisting of executable files
and DLL files in IL form. At least one of
these assemblies will contain an
executable file that has been designated
as the entry point for the application.
Execution of a .NET Application

Execution of a .NET Application
• The first assembly is loaded into memory.

At this point, the common language runtime
examines the assembly manifest and determines the
requirements to run the program.
• The CLR examines security permissions
requested by the assembly and compares
them with the system’s security policy.

If the system’s security policy does not allow the
requested permissions, the application will not run.
• If the application passes the system’s security
policy, the CLR executes the code.
• It creates a process for the application and
begins application execution.
Execution of a .NET Application (cont.)
• When execution starts, the first bit of code that needs to
be executed is loaded into memory compiled into native
binary code from IL by the common language runtime’s
Just-In-Time (JIT) compiler.
• Once compiled, the code is executed and stored in
memory as native code.
• Thus, each portion of code is compiled only once when
an application executes.
• Whenever program execution branches to code that has
not yet run, the JIT compiler compiles it ahead of
execution and stores it in memory as binary code. This
way, application performance is maximized because only
the parts of a program that are executed are compiled.
Summary




.NET was needed because Software is hard to
develop; and it is just getting harder with the
passage of time.
.NET solves many development problems by
standardizing certain elements of the
programming environment.
The Common Language Runtime and the
Foundation Class Library are the core
components of the .NET Framework. These
components are what make the promises of .NET
real.
.NET applications are not complied like traditional
applications.
Any Questions?
Post to Classes Q&A discussion
board!!!!