COMS W4156: Advanced Software Engineering - PowerPoint PPT Presentation

Loading...

PPT – COMS W4156: Advanced Software Engineering PowerPoint presentation | free to download - id: 8281b6-OGYwY



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

COMS W4156: Advanced Software Engineering

Description:

COMS W4156: Advanced Software Engineering Prof. Gail Kaiser Kaiser+4156_at_cs.columbia.edu http://york.cs.columbia.edu/classes/cs4156/ – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 46
Provided by: GailK156
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: COMS W4156: Advanced Software Engineering


1
COMS W4156 Advanced Software Engineering
  • Prof. Gail Kaiser
  • Kaiser4156_at_cs.columbia.edu
  • http//york.cs.columbia.edu/classes/cs4156/

2
.NET and Component Services
3
What is .NET?
  • An object-oriented general purpose software
    development platform with multi-language
    interoperability
  • Common Language Infrastructure (CLI)
  • Common Type System
  • Common Intermediate Language
  • Common Language Specification
  • common Virtual Execution Environment
  • common XML metadata representation
  • CLI specification is an ECMA standard (originally
    European Computer Manufacturers Association,
    http//www.ecma-international.org/)

4
Overview of the CLI
  • A file format
  • A common type system
  • An extensible metadata system
  • An intermediate language
  • Access to the underlying platform
  • A factored base class library

5
File Format
  • Based on Common Object File Format (predecessor
    to ELF on Unix but a variant still used for
    Windows)
  • Code represented as MSIL (Microsoft Intermediate
    Language) instructions
  • Metadata stored in read-only area
  • Methods include a descriptive header
  • Stack frame size
  • Types of local variables and parameters
  • Pinned variable information
  • Exception handler table

6
Common Type System
  • Spans large number of languages
  • Object-oriented in flavor
  • Supports procedural and functional languages, too
  • Includes value types (structs), pointers and
    by-reference values
  • Subset for wide reach

7
Metadata System
  • Self-description for assemblies (components)
  • Includes referenced assemblies
  • Allows crypto-strong names
  • Records version information
  • Security boundary
  • Self-description for types
  • Name and defining assembly
  • Member information (fields, methods, etc.)
  • Extensible through custom attributes
  • Stored in file along with code

8
Intermediate Language
  • Simple stack machine model
  • Typeless opcodes (add, not add.int32)
  • Signed and unsigned via opcode, not type
  • Rich set of conversion operations
  • Tail calls, virtual dispatch, call via function
    pointer, exception handling
  • Typed variable argument lists, dynamically typed
    pointers
  • Objects, vectors, strings, integers, floats
    built-in

9
Access to Platform
  • Metadata describes managed and unmanaged
    interface
  • Marshaling is automatic for many types
  • Custom marshaling can be specified
  • Platform-specific transformations are possible
    (ANSI lt-gt Unicode, etc.)
  • Platform-specific calling conventions can be
    specified

10
Factored Class Library
  • Designed for cross-language use
  • Factored to allow minimal footprint and minimal
    hardware requirements (minimal base is always
    present)
  • File format independent of factorization
  • Intended to be platform-neutral
  • Three layers kernel, basic language, additional
    functionality

11
Methodology
  • Define Kernel
  • Fixes file format
  • Hand-picked classes and methods
  • Define Basic Language
  • Minimal hardware support required
  • Most common language features (including those
    required for C)
  • Depends on classes defined in Kernel
  • Package each advanced function separately
  • Implemented a la carte by runtime vendors
  • Required a la carte by developers

12
Languages and Packages
  • C
  • Requires Kernel, Basic Language and Extended
    Numerics
  • ECMAScript
  • Requires above plus Reflection
  • ISO C
  • Requires Kernel, Basic Language, Extended
    Numerics, and NonCLS

13
Scenario-based System Design
Scenario Required Packages
Minimal Kernel
C Program Kernel, Basic Language
Ex Connected C Application Kernel, Basic Language, Common DT, Networking
Ex Connected XML C Application Kernel, Basic Language, Common DT, Advanced DT, Networking, XML, IO, Collections
14
Categories of Packages
  • Classes grouped into packages
  • Packages grouped into five categories

Miscellaneous
High Level Programming
Abstract OS Interfaces
Common Programming Utilities
EE Functionality
15
Abstract OS Interface
  • Platform-independent operating system
    functionality
  • Networking
  • System.Net.
  • Security
  • System.IsolatedStorage, System.Security,
  • Standard I/O
  • System.Console, System.IO, System.Text,
  • Threading
  • System.Threading,

16
Common Programming Utilities
  • Classes that support typical programming patterns
  • Common Data Types
  • System.DateTime, System.Text.StringBuilder, etc.
  • Advanced Data Types
  • System.BitConverter, System.URI,
  • Collections
  • System.Collections
  • Extended Numerics
  • System.Decimal, System.Double, etc.
  • Regular Expressions
  • System.Text.RegularExpressions.
  • Serialization
  • System.Runtime.Serialization., etc.

17
High-Level Programming
  • Advanced programming patterns
  • Asynchronous Programming
  • System.AsyncCallback, System.IAsyncResult
  • Globalization
  • System.Globalization., System.Resources., etc.
  • Remoting
  • System.Runtime.Remoting.
  • XML
  • System.Xml. (parsing and generation)
  • Advanced XML
  • System.Xml.Xsl., System.Xml.XPath.

18
Execution Environment Functionality
  • Revealing underlying operations to programming
    languages
  • GC
  • System.WeakReference, System.WeakReferenceExceptio
    n
  • Hosting
  • System.OperatingSystem, etc.
  • NonCLS
  • System.ArgIterator, etc.
  • Reflection
  • System.Reflection., etc.
  • Unmanaged
  • System.Runtime.InteropServices, etc.

19
Miscellaneous
  • Kernel, Basic Language, and support for
    developers
  • Kernel
  • 1, 2, and 4 byte integers, arrays, string,
    object, etc.
  • Basic Language Support
  • System.EventHandler, System.IFormattable,
    System.Type, etc.
  • Development Time
  • System.Diagnostics., System.Runtime.CompilerServi
    ces.

20
CLI Summary
  • A file format
  • A common type system
  • An extensible metadata system
  • An intermediate language
  • Access to the underlying platform
  • A factored base class library

21
Back to What is .NET?
  • Common Language Runtime (CLR) is Microsofts
    implementation of CLI
  • Compilers for C, VB.NET and C turn source code
    into MSIL that runs on CLR
  • Extensive Framework Class Libraries, supporting
    windows GUI development (Windows Forms), database
    access (ADO.NET), web development (ASP.NET), web
    services, XML, etc.
  • Other implementations of CLI Mono, DotGNU

22
Why do they call it .NET?
  • I don't know what they were thinking. They
    certainly weren't thinking of people using search
    tools. It's meaningless marketing nonsense.
    Andy McMullan

23
How do multiple languages interoperate?
  • A compiler from any language compiles an
    application into MSIL (also referred to as CIL
    Common Intermediate Language)
  • The compiler also generates metadata in XML
    information on the types and named entities
    (classes, methods, fields, etc.) defined and used
    in the application
  • At runtime, the CIL code is Just-in-Time (JIT)
    compiled into the target platforms native code
  • The CLR uses the metadata to perform runtime
    checks for type-safety and security (managed
    code)

24
Common Language Runtime Execution Model
Source code
VB
C
C
Compiler
Compiler
Compiler
Assembly
Assembly
Assembly
MSIL
Common Language Runtime JIT Compiler
CLR
Native code
Managed Code
Managed Code
Managed Code
Unmanaged Code
CLR Services
Operating System Services
25
What does managed mean?
  • Managed code .NET provides several core run-time
    services to the programs that run within it,
    e.g., exception handling and security - for these
    services to work, the code must provide a minimum
    level of information to the runtime
  • Managed data Data that is allocated and freed by
    the .NET runtime's garbage collector
  • Managed classes A C class can be marked with
    the __gc keyword - then memory for instances of
    the class are managed by the garbage collector
    and the class can interoperate with classes
    written in other CLR languages, e.g., inherit
    from a VB class (also restrictions, e.g., a
    managed class can only inherit from one base
    class)

26
What is an assembly?
  • A logical .exe or .dll, can be an application
    (with a main entry point) or a library
  • Consists of one or more files (dlls, exes, html
    files, etc), and represents a group of resources,
    type definitions, implementations of those types,
    and references to other assemblies
  • These resources, types and references are
    described in a block of data called a manifest
    -part of the assembly making it self-describing
  • Assemblies often referred to as components

27
More on Assemblies
  • The identity of a type is the assembly that
    houses it combined with the type name if
    assembly A exports a type called T, and assembly
    B exports a type called T, .NET sees these as two
    completely different types (separate from .NET
    namespaces)
  • Many of the security restrictions are enforced at
    the assembly boundary
  • Also unit of versioning (version number consists
    of 4 parts, convention is major.minor.build.revisi
    on)
  • Produced by compiler (single module) or linker
    (multiple modules)

28
Private vs. Shared Assemblies
  • A private assembly is normally used by a single
    application, and is stored in the application's
    directory
  • A shared assembly is intended to be used by
    multiple applications, and is normally stored in
    the global assembly cache (GAC) but can be stored
    elsewhere
  • Assemblies find each other (outside the GAC) by
    searching directory paths

29
Attributes
  • Metadata attributes attach some data to a class
    or method, which can be accessed via reflection,
    e.g., serializable
  • Context attributes provide an interception
    mechanism whereby instance activation and method
    calls can be pre- and/or post- processed
  • Analogous to use of Java annotations in EJB 3.0

30
Remoting
  • Send messages along channels, e.g., TCP or HTTP
  • Multiple serialization formats, e.g., SOAP (for
    HTTP) or binary (for TCP, similar to DCOM)
  • Distributed garbage collection of objects is
    managed by leased based lifetime when that
    time expires the object is disconnected from the
    .NET runtime remoting infrastructure unless in
    the interim renewed by a successful call from the
    client to the object (or explicit renewal by
    client)

31
Remote Invocations
  • SingleCall Each incoming request from a client
    is serviced by a new object
  • Singleton All incoming requests from clients are
    processed by a single server object
  • Client-activated object Same as stateful (D)COM,
    whereby the client receives a reference to the
    remote object and holds that reference (thus
    keeping the remote object alive) until it is
    finished with it

32
So Wheres the Component Services?
33
So Wheres the Component Services?
  • COM
  • (and Web Services)

34
Recall COM Services
  • Transactions
  • Role-base security
  • Queued components
  • Loosely coupled events
  • Just-in-time activation
  • Object pooling

35
.NET Serviced Components
  • COM services can be used by .NET components
    derived from the ServicedComponent class using
    the System.EnterpriseServices namespace
  • Must be registered with the COM catalog
  • Can also use COM services outside components
    (Windows 2003 only)

36
Example
37
Example Server
  • using System.EnterpriseServices
  • using System.Runtime.CompilerServices
  • using System.Reflection
  • // Supply the COM application name.
  • assembly ApplicationName("BankComponent")
  • // Supply a strong-named assembly.
  • assembly AssemblyKeyFileAttribute("BankComponent
    .snk")
  • namespace BankComponent Transaction(Transaction
    Option.Required)
  • public class Account ServicedComponent
    AutoComplete
  • public bool Post(int accountNum, double amount)
  • / Updates the database no need to call
    SetComplete. Calls SetComplete automatically if
    no exception is generated (which calls
    SetAbort). /
  • return false

38
Example Client
  • using BankComponent
  • namespace BankComponentConsoleClient
  • class Client
  • public static int Main()
  • try
  • Account act new
    Account()
  • // Post money into the
    account.
  • act.Post(5, 100)
  • return(0)
  • catch
  • return(1)

39
.NET/COM Interoperability
  • Access classic COM components via a Runtime
    Callable Wrapper converts the COM interfaces
    to .NET-compatible interfaces, marshals method
    calls, maintains objects lifetime, etc.

40
COM/.NET Interoperability
  • A classic COM client can also treat a
    (registered) .NET assembly as a regular COM
    server, using a COM Callable Wrapper that
    mimics QueryInterface, AddRef, Release, etc.

41
.NET vs. COM
  • No IUnknown base interface
  • No reference counting, uses garbage collection
    (also in practice reference counting often used
    to avoid race conditions)
  • No class factories, the .NET runtime resolves to
    a particular class within an assembly
  • No apartments, programmer synchronizes (or uses
    automatic .NET synchronization domains)

42
.NET vs. COM
  • No IDL (Interface Definition Language) files, the
    compiler generates the assembly metadata and
    dependencies are captured during compilation (in
    manifests)
  • No GUIDs (globally unique identifiers), instead
    uses scoping based on namespaces and strong
    names (unique digital signature using an
    encryption key)
  • Evidence-based security (where component came
    from), in addition to role-based
  • Doesnt rely on registry, reduces DLL Hell
  • Different distributed computing (remoting) model

43
IDA 3 Due Next Week!
  • Tuesday 2 October, 10am
  • Assignments posted on course website
  • Submit via CourseWorks
  • Individual Development Assignment 3

44
Upcoming Deadlines
  • Revised project concept due October 9th first
    iteration begins
  • First iteration plan due October 16th
  • First iteration progress report due October 23rd
  • First iteration demo week October 30th November
    8th
  • First iteration final report due November 9th

45
COMS W4156 Advanced Software Engineering
  • Prof. Gail Kaiser
  • Kaiser4156_at_cs.columbia.edu
  • http//york.cs.columbia.edu/classes/cs4156/
About PowerShow.com