Introductionto .netframework by Priyanka Pinglikar

37

Click here to load reader

Transcript of Introductionto .netframework by Priyanka Pinglikar

Page 1: Introductionto .netframework by Priyanka Pinglikar

Introduction to .Net Framework

Priyanka Pinglikar

Page 2: Introductionto .netframework by Priyanka Pinglikar

What is framework A structure for supporting or enclosing

something else, especially a skeletal support used as the basis for something being constructed.

In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.

A software framework is a universal, reusable software platform to develop applications, products and solutions

Page 3: Introductionto .netframework by Priyanka Pinglikar

.Net Framework .NET Framework is entirely new environment

for building internet aware application with

truly simplified deployment model . The .NET Framework is a

software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large library and provides language interoperability (each language can use code written in other languages) across several programming languages

Page 4: Introductionto .netframework by Priyanka Pinglikar

.Net, the Rescuer

.NET

OOP JVM

GUIWeb

component-based design n-tier design

Page 5: Introductionto .netframework by Priyanka Pinglikar

.Net providesIntegrated environment

Internet, Desktop , Mobile devices

consistent object-oriented

To provide a portable environment

A managed environment

Page 6: Introductionto .netframework by Priyanka Pinglikar

What Is .NET.NET is a framework

New programming methodology

.NET is platform independent / cross

platform

.NET is language-insensitive

Page 7: Introductionto .netframework by Priyanka Pinglikar

Narrow view of .Net applications

Operating System + Hardware

.NET Framework

.NET Application

Page 8: Introductionto .netframework by Priyanka Pinglikar

.Net Architecture.NET architecture is:

multi-languagecross-platformbased on the CLR, FCL, and JIT

technology.NET components are packaged as

assemblies

Page 9: Introductionto .netframework by Priyanka Pinglikar

.Net Architecture

Page 10: Introductionto .netframework by Priyanka Pinglikar

.Net Technical Architecture

Base Class Library

Common Language Specification

Common Language Runtime

ADO.NET: Data and XML

VB C++ C#

Visual Studio.NET

ASP.NET: Web Servicesand Web Forms

JScript …

WindowsForms

WindowsForms

Page 11: Introductionto .netframework by Priyanka Pinglikar

Common Language RuntimeA common runtime for all .NET languages

Common type systemCommon metadata Intermediate Language (IL) to native code compilersMemory allocation and garbage collectionCode execution and security

Over 15 languages supported todayC#, VB, Jscript, Visual C++ from MicrosoftPerl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel,

Oberon, Oz, Pascal, APL, CAML, Scheme, etc.

Page 12: Introductionto .netframework by Priyanka Pinglikar

The CLR Architecture

Class Loader

MSIL to NativeCompilers (JIT)

CodeManager

GarbageCollector (GC)

Security Engine Debug Engine

Type Checker Exception Manager

Thread Support COM Marshaler

Base Class Library Support

Page 13: Introductionto .netframework by Priyanka Pinglikar

CLR Execution Model (Narrow)Code in VB.NET Code in C# Code in another

.NET Language

VB.NET compiler C# compiler AppropriateCompiler

IL(IntermediateLanguage) code

CLR just-in-timeexecution

Page 14: Introductionto .netframework by Priyanka Pinglikar

CLR Execution ModelVBSource

codeCompiler

C++C#

CompilerCompiler

AssemblyIL Code

AssemblyIL Code

AssemblyIL Code

Operating System Services

Common Language Runtime

JIT Compiler

Native Code

Managedcode

UnmanagedComponent

Page 15: Introductionto .netframework by Priyanka Pinglikar

How CLR works?

Page 16: Introductionto .netframework by Priyanka Pinglikar

Common Language RuntimeExecution Engine

Compiles Microsoft Intermediate Language (MSIL) into native code

Handles garbage collectionHandles exceptionsEnforces code access securityHandles verification

Managed v. Unmanaged

Page 17: Introductionto .netframework by Priyanka Pinglikar

Implications of CLR execution model1. Clients need CLR & FCL to run .NET apps

available via Redistributable .NET Framework

2. Design trade-off…+ managed execution (memory

protection, verifiable code, etc.)+ portability:– slower execution?

Page 18: Introductionto .netframework by Priyanka Pinglikar

CLR and JIT compiling.Indirect execution of .Net applications.All .NET languages compile to the same CIL.The CLR transforms the CIL to assembly

instructions for a particular hardware architecture.This is termed jit’ing or Just-in-time compiling.Some initial performance cost, but the jitted

code is cached for further execution.The CLR can target the specific architecture in

which the code is executing, so some performance gains are possible.

Page 19: Introductionto .netframework by Priyanka Pinglikar

Advantages of CLRInteroperation between managed code and

unmanaged code (COM, DLLs).

Managed code environment

Improved memory handling

Improved “garbage collection”

Page 20: Introductionto .netframework by Priyanka Pinglikar

Advantages of CLRJIT allows code to run in a protected environment as

managed code.

JIT allows the IL code to be hardware independent.

CLR also allows for enforcement of code access security.

Verification of type safety.

Access to Metadata (enhanced Type Information)

Page 21: Introductionto .netframework by Priyanka Pinglikar

Common Language Infrastructure

Page 22: Introductionto .netframework by Priyanka Pinglikar

CLI

Page 23: Introductionto .netframework by Priyanka Pinglikar

Common Language InfrastructureCLI allows for cross-language development.

Four components:Common Type System (CTS)Meta-data in a language agnostic fashion.Common Language Specification – behaviors

that all languages need to follow.A Virtual Execution System (VES).

Page 24: Introductionto .netframework by Priyanka Pinglikar

Common Type System (CTS)A specification for how types are

defined and how they behave.no syntax specified

A type can contain zero or more members:FieldMethodPropertyEvent

Page 25: Introductionto .netframework by Priyanka Pinglikar

Common Type System (CTS)

St r i ng Ar r ay Val ueType Except i on Del egat e Cl ass1

Mul t i castDel egat e Cl ass2

Cl ass3

Obj ect

Enum1

St r uct ur e1EnumPr i mi t i ve t ypes

Bool ean

Byt e

I nt 16

I nt 32

I nt 64

Char

Si ngl e

Doubl e

Deci mal

Dat eTi me

System-defined types

User-defined types

Del egat e1

Ti meSpan

Gui d

Page 26: Introductionto .netframework by Priyanka Pinglikar

CTS Data Types

Page 27: Introductionto .netframework by Priyanka Pinglikar

Common Data TypesCLR provides a set of primitive types that all

languages must support. The data types include:

Integer—three types 16/32/64 bitsFloat—two types: 32/64 bitsBoolean and CharacterDate/time and Time span

The primitive types can be collected intoArraysStructuresCombination of the two

Page 28: Introductionto .netframework by Priyanka Pinglikar

Common Language Specification (CLS)Not all languages support all CTS types

and featuresC# is case sensitive, VB.NET is notC# supports pointer types (in unsafe mode),

VB.NET does notC# supports operator overloading, VB.NET

does not

CLS was drafted to promote language interoperabilityvast majority of classes within FCL are CLS-

compliant

Page 29: Introductionto .netframework by Priyanka Pinglikar

Comparison to Java

Hello.java Hello.class JVMcompile execute

Hello.vb Hello.exe CLRcompile execute

Source code Byte code

CILSource code

Page 30: Introductionto .netframework by Priyanka Pinglikar

Base Class Library @ FCL

Unified ClassesWeb Classes (ASP.NET)

XML Classes

System Classes

Drawing Classes

Windows FormsData (ADO.NET)

Controls, Caching, Security, Session, Configuration etc

Collections, Diagnostics, Globalization, IO, Security,Threading Serialization, Reflection, Messaging etc

ADO, SQL,Types etc

Drawing, Imaging, Text, etc

Design, Cmpnt Model etc

XSLT, Path, Serialization etc

Page 31: Introductionto .netframework by Priyanka Pinglikar

Base Class LibrarySimilar to Java’s System namespace.

Used by all .NET applications

Has classes for IO, threading, database, text, graphics, console, sockets/web/mail, security, cryptography, COM, run-time type discovery/invocation, assembly generation

Page 32: Introductionto .netframework by Priyanka Pinglikar

Framework Class Library @ BCLSingle consistent set of object oriented class

libraries to enable building distributed web applications (Unified Classes)

Built using classes arranged across logical hierarchical namespaces

Work with all CLR languagesNo more “VBRun” or “MFC” divide

Page 33: Introductionto .netframework by Priyanka Pinglikar

Example

Page 34: Introductionto .netframework by Priyanka Pinglikar

Intermediate Language (IL).NET languages are not compiled to machine code.

They are compiled to an Intermediate Language (IL).

CLR accepts the IL code and recompiles it to machine code. The recompilation is just-in-time (JIT) meaning it is done as soon as a function or subroutine is called.

The JIT code stays in memory for subsequent calls. In cases where there is not enough memory it is discarded thus making JIT process interpretive.

Page 35: Introductionto .netframework by Priyanka Pinglikar

Queries?

Page 36: Introductionto .netframework by Priyanka Pinglikar

Thank you !!!

Page 37: Introductionto .netframework by Priyanka Pinglikar

DisclaimerThe names of Technologies, Product(s),

Companies, Application(s), Tool(s), Utilities,

etc provided with this material are intended

to reference only. The name(s), brand

name(s), trademark(s), registered

trademark(s), logo(s), slogan(s) belong to

their respective owners in the respective

countries.