Introduction to the Microsoft .NET Framework

download Introduction to the Microsoft .NET Framework

of 18

Transcript of Introduction to the Microsoft .NET Framework

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    1/18

    Introduction to the

    Microsoft .NET Framework

    Chris Wastchak

    Student Ambassador to Microsoft

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    2/18

    What is the .NET Framework

    A new computing platform designed to

    simplify application development

    A consistent object-oriented programming

    environment

    A code-execution environment that:

    Minimizes software deployment and versioning

    conflicts Eliminates the performance problems of scripted

    or interpreted environments

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    3/18

    Primary Components of .NET

    .NET Framework Class Libraries

    Object-oriented collection of reusable types

    Sits on-top of the Common Language Runtime

    Common Language Runtime (CLR)

    Manages code execution at runtime

    Memory management, thread management, etc.

    Code designed for the CLR is referred to asManaged Code

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    4/18

    Managed execution in the Common Language Runtime (CLR)

    Managed Code

    Common Language

    Runtime (CLR)

    Win32 OS

    Requests for existing

    features, such as opening

    a file, mediated by CLR

    New CLR-only features,

    such as garbage collection

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    5/18

    Operating SystemOperating System

    Common Language Runtime (CLR)

    Inside the .NET Framework

    Base Framework

    Data and XML

    Web Services User Interface

    VB C++ C#

    ASP.NET

    J# Python

    Secure, integrated class

    libraries

    Unifies programming models

    across languages

    Enables cross-languageintegration

    Factored for extensibility

    Designed for tools

    Common Language

    Runtime

    Executes code, maintains

    security, handles component

    plumbing and dependencies

    ASP.NET

    High-productivity environment for

    building and running Web

    services

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    6/18

    One Runtime For Many Languages

    CLR is an open standard Any language can make use of CLR services

    Any language can use classes written in any

    other language

    Any language can inherit classes written in any

    other language

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    7/18

    AdaAda

    APLAPL Basic (Visual Basic)Basic (Visual Basic)

    C#C#

    CC

    C++C++ Java LanguageJava Language

    COBOLCOBOL

    Component PascalComponent Pascal

    (Queensland Univ of Tech)(Queensland Univ of Tech) ECMAScript (JScript)ECMAScript (JScript)

    Eiffel (Eiffel (MonashMonashUniversity)University)

    HaskellHaskell(Utrecht University)(Utrecht University)

    Current List of Language Compilers lcclcc

    (MS Research Redmond)(MS Research Redmond)

    MondrianMondrian (Utrecht)(Utrecht)

    MLML(MS Research Cambridge)(MS Research Cambridge)

    MercuryMercury

    (Melbourne U.)(Melbourne U.) OberonOberon

    (Zurich University)(Zurich University)

    Oz (Oz (Univ of Saarlandes)Univ of Saarlandes)

    SmallTalkSmallTalk PythonPython

    SchemeScheme(Northwestern U.)(Northwestern U.)

    PerlPerl

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    8/18

    .NET Framework Class Libraries

    Sit on top of the CLR

    Reusable types that tightly integrate with the

    CLR

    Object oriented inheritance, polymorphism,

    etc.

    Provide functionality for ASP.NET, XML Web

    Services, ADO.NET, Windows Forms, basicsystem functionality (IO, XML, etc.)

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    9/18

    The Common Language Runtime

    Code that targets the CLR is referred to as

    managed code

    All managed code has the features of the CLR

    Object Oriented

    Cross-language integration

    Cross language exception handling

    Multiple version support (no more DLL Hell)

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    10/18

    The Common Language Runtime

    The CLR manages object layout and references to

    objects

    Objects whose lifetimes are managed by the CLR are

    referred to as Managed Data Automatic memory management reduces memory

    leaks

    In managed code you can use:

    Managed Data Unmanaged data

    Both

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    11/18

    The Common Language Runtime

    All CLR-compliant compilers use a common type

    system

    Allows for cross-language inheritance

    Passing object instances across language barriers

    Invoking methods across language barriers

    Managed components expose metadata

    Metadata includes

    Resources component was compiled against

    Information about types and dependencies (no more

    RegServ32)

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    12/18

    Managed Execution Process

    public void Fill()

    {

    DotNetJunkies.StudyGroupPortal.Data.EventDB eDB= new DotNetJunkies.StudyGroupPortal.Data.EventDB();

    //Create a data reader

    IDataReader reader = eDB.GetEventByGuid(_guid);

    //Advance to the first record in the reader

    reader.Read();//Populate this instance of the Event class

    this.CreateEvent(ref reader);

    //Close the reader

    reader.Close();}

    MSIL

    Language Specific Compiler

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    13/18

    Microsoft Intermediate Language

    Managed code is compiled to MSIL

    CPU-independent set of instructions

    Loading, storing, initializing and calling methods

    Arithmetic and logical operations, etc.

    Control flow, exception handling, direct memory

    access

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    14/18

    Just-In-Time Compiling

    Assemblies are compiled to native code by a

    Just-In-Time compiler (JITer)

    Compiled assemblies include metadata

    No Type Libraries or Interface Definition

    Language (IDL)

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    15/18

    AssemblyAssembly

    Compilation And Execution

    SourceSource

    CodeCodeLanguageLanguage

    CompilerCompiler

    CompilationCompilation

    Before installation orBefore installation or

    the first time eachthe first time each

    method is calledmethod is calledExecutionExecution

    JITJITCompilerCompiler

    NativeNativeCodeCode

    CodeCode(IL)(IL)

    MetadataMetadata

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    16/18

    Just-In-Time Compiling

    All assemblies must be compiled to nativecode before executing

    JIT compilers are built into the CLR for every

    supported CPU architecture JIT compilers convert MSIL to native on

    demand

    Resulting native code is stored for reuse

    JIT compiling occurs for each method afterthe application is restarted

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    17/18

    Summary

    .NET Framework is a code execution platform

    .NET Framework consists of two primary parts: .NET

    Class Libraries, Common Language Runtime

    All CLR-compliant compilers support the commontype system

    Managed code is object oriented

    Managed code is compiled to an assembly (MSIL) by

    language specific compiler Assemblies are compiled to native code by JIT

    compiler

  • 8/14/2019 Introduction to the Microsoft .NET Framework

    18/18

    Questions?