Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 330 -.NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.

Similar presentations


Presentation on theme: "CIS 330 -.NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials."— Presentation transcript:

1 CIS 330 -.NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials

2 CIS 330 -.NET Applications2 Objectives Language Independence: – The CLR Packaging and Deployment: Assemblies Binary Compatibility

3 CIS 330 -.NET Applications3 The Common Language Runtime (CLR) Common context within which all.NET components execute Manages all runtime aspects of the code –Memory management –Secure environment –Access to underlying OS services CLR code called Managed Code Visual Studio 2005 provides C#, Visual Basic, J#, and managed C++ 3 rd party vendors provide another 20 Languages including COBOL.

4 CIS 330 -.NET Applications4 Intermediate Language and the JIT Compiler Compiling.NET managed code –First Phase: High-level code is compiled into intermediate language (IL) –Second Phase: Just in time (JIT) compiler creates native machine code.NET components are Language-Independent RAD developer – recommend Visual Basic Enterprise developer – recommend C#

5 CIS 330 -.NET Applications5 Packaging and Deployment: Assemblies DLLs and COM Components –DLL management – installation/removal –Versioning management difficult –Security management fragile.NET Assemblies: basic packaging unit –Contains version, security, and deployment attributes –Can contain one or more physical files or modules Class Library – DLL Standalone Application – EXE Resources – icons, pictures, or localized strings –Recommend separate assemblies for class libraries, applications, and resources.

6 CIS 330 -.NET Applications6 Assemblies and Visual Studio 2005 Lab 2: Using References –Create MyClassLibrary as described on page 25. –Add a reference to this as described on pages 27-29. The reference path Namespaces Aliasing a reference Visual Studio 2005 assembly host –.vshost.exe always available for “running” app inside the IDE. –Partial trust debugging –Shorter startup time –Design-time expression evaluation

7 CIS 330 -.NET Applications7 Client and Server Assemblies Can add references to both application and library assemblies Application assemblies (EXE) –Can be directly launched –Dictates which CLR version is used –Allows partial-trust debugging (DLL don’t) –ClickOnce publishing and deployment

8 CIS 330 -.NET Applications8 Component Visibility Internal components (default) –Only clients inside its own assembly can access Public components –Clients from inside and outside assembly can access Protected Internal (for inheritance) –Allows access to internal clients and external subclasses only

9 CIS 330 -.NET Applications9 Assembly Metadata Contains comprehensive standard description of what’s in an assembly Contains –Available types (name, visibility, base class, interfaces) –Namespaces –Method names and parameters Automatically generated Used by compilers or through code (reflection) Remote call marshaling

10 CIS 330 -.NET Applications10 Assembly Manifest Describes the assembly –Logical attributes shared by all modules –Assembly name, version number, locale –Security demands –Names and hashes of all files

11 CIS 330 -.NET Applications11 Binary Compatibility COM Binary Compatibility.NET Binary Compatibility –Uses Metadata –High-level code compiled to IL –Component/Method calls (tokens) converted to actual addresses during JIT compiling –Additionally, order of server methods doesn’t matter as long as the interface definition doesn’t change Interface Pointer Virtual table ptr Pointer to method 1 Pointer to method 2 Pointer to method 3 Code

12 CIS 330 -.NET Applications12 Summary Language Independence: – The CLR Packaging and Deployment: Assemblies Binary Compatibility


Download ppt "CIS 330 -.NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials."

Similar presentations


Ads by Google