Presentation is loading. Please wait.

Presentation is loading. Please wait.

Camel Crossings: Perl & the Microsoft.NET Framework Brad Merrill, Microsoft Jan Dubois, ActiveState Eric Promislow, ActiveState.

Similar presentations


Presentation on theme: "Camel Crossings: Perl & the Microsoft.NET Framework Brad Merrill, Microsoft Jan Dubois, ActiveState Eric Promislow, ActiveState."— Presentation transcript:

1

2 Camel Crossings: Perl & the Microsoft.NET Framework Brad Merrill, Microsoft Jan Dubois, ActiveState Eric Promislow, ActiveState

3 .NET Framework Overview Brad Merrill.NET Languages Evangelist.NET Developer Platform

4 .NET Blueprint Open Internet Protocols SOAP, SCL, DISCO HTTP, SMTP, XML, WAP, XSD HTTP, SMTP, XML, WAP, XSD Your Application and Web Service.NET Framework Windows CE, ME, 2000,.NET Operations End-User Clients Other Applications Using Your Service Orchestration Your Internal Services.NET Enterprise Servers.NET MyServices Public Web Services Visual Studio.NET

5 Windows (CE, ME, 2000, and.NET) Orchestration.NET Enterprise Servers.NET My Services.NET Framework.NET Framework Base Classes Data & XML User Interface Common Language Runtime Web Services

6 Inside the.NET Framework Common Language Runtime Base Framework Data and XML Web ServicesUser Interface VBC++C# ASP.NET PerlEiffelCobol Common Language Runtime Executes code, maintains security, handles component “plumbing” and dependencies Secure, integrated class libraries Unifies programming models across languages Enables cross-language integration Factored for extensibility Designed for tools Active Server Pages.NET High-productivity environment for building and running Web services

7 Acronyms  CLR – Common Language Runtime  CTS – Common Type System  EE – Execution Environment  CIL – Common Intermediate Language  CLS – Common Language Specification

8 Common Language Runtime Frameworks Class loader and layout IL to native code compilers GC, stack walk, code manager Security Execution Support Base Classes

9 Common Type System  Static (compile time) typed  Object-Oriented  fields, methods, nested types, properties, etc.  Overloading resolved by the compiler  Virtual dispatch based on runtime type  Single implementation inheritance  Multiple interfaces

10 Managed Code  Metadata describes datatypes  Uses object references  Exception handling  ISO C++ can be managed

11 Managed Data  Layout provided by runtime  Automatic or Specified  Lifetime managed by runtime (GC)  Working set is compacted  Managed extensions required for C++

12 Terms  Managed Code  CIL implemented types and assemblies  Unmanaged Code  Native code  Win32, Kernel, etc.

13 Assemblies  Unit of deployment  One or more files, independent of packaging  Self-describing via manifest  Versioning  Provided by compiler use of attributes  Policy per-application as well as per-machine  Security boundary  Assemblies are granted permissions  Methods can demand permissions  Mediate type import and export  Types named relative to assembly

14 Applications  Are configurable units  One or more assemblies  Application-specific files or data  Assemblies are located based on…  Their logical name and  The application that loads them  Can have private versions of assemblies  Private version preferred over shared  Version policy can be per-application

15 Metadata  Key to simpler programming model  Generated automatically  Stored with code in executable file (.dll or.exe)  Uses existing COFF format  Via existing extension mechanism  Stored in binary format  Convertible to/from XML Schema  Convertible to/from COM type libraries

16 Metadata: Creation And Use Metadata (and code) Debugger SchemaGenerator Profiler OtherCompiler Proxy Generator Type Browser Compiler SourceCode XML encoding (SDL or SUDS) Serialization (e.g. SOAP) Designers Reflection

17 CIL: Key Design Points  Compilation, not interpretation  Stack-based  Typeless operations  Value types (C structs)  Size-agnostic (32/64 bit) integers  Pointers with arithmetic and indirection  Verification conditions specified

18 VBC#CobolEiffel CIL Native Code Pre-JIT Image Standard JIT Compiler Native Code Install time Code Gen Common Language Runtime Execution Model

19 Runtime Control Flow Class Loader IL to native code compiler CPU Security System Code Managers Managed Native Code Assembly First call to method First reference to type Execution Support

20 Interop Mechanisms  Platform invoke (P/Invoke)  Automated type marshalling  Implicit reference pinning  Knowledge of GC implications required  COM interop services  Built-in Attributes  Type library conversion tools provided  Registration provided by tools

21 Calling Unmanaged Code Native Code JIT Compiler Native Code Common Language Runtime Unmanaged Managed

22 Interoperability Services C# VB C++ MSVCRT MFC/ATL Type System Standard Binary Standard

23 What Is The Common Language Specification?  Rules for “published” contracts  Doesn’t apply within a single assembly  Full common type system for internal contracts and implementation  Three classes of use:  Consumer tools  Extender tools  Frameworks  Design and naming patterns

24 Existing Type Systems class Hello { public static void Main() { System.Console.WriteLine(“C#”); { System.Console.WriteLine(“C#”); }} Public Module Hello Sub Main() Sub Main() System.Console.WriteLine(“VB”) System.Console.WriteLine(“VB”) End Sub End Sub End Module IDENTIFICATION DIVISION PROGRAM-ID. MAIN PROCEDURE DIVISION DISPLAY “COBOL” END PROGRAM MAIN. (define (hello) (display “Scheme”)) “Scheme”))

25 Existing Type Systems class Hello { public static void Main() { System.Console.WriteLine(“C#”); { System.Console.WriteLine(“C#”); }} Public Module Hello Sub Main() Sub Main() System.Console.WriteLine(“VB”) System.Console.WriteLine(“VB”) End Sub End Sub End Module IDENTIFICATION DIVISION PROGRAM-ID. MAIN PROCEDURE DIVISION DISPLAY “COBOL” END PROGRAM MAIN. (define (hello) (display “Scheme”)) “Scheme”)).assembly hello {}.assembly extern mscorlib {}.method static public void main() il managed {.entrypoint.maxstack 1 ldstr “CIL” callvoid [mscorlib] System.Console::WriteLine(class System.String) ret }

26 CLS: Designing For Reach COBOL C++ C++ Common Type System CLS Microsoft Managed C++ Extensions Fujitsu COBOL Extensions Common Type System is too big for any single language Common Type System is too big for any single language Common Language Specification is for cross-language use Common Language Specification is for cross-language use

27 Framework Classes  Spans all programming languages  Object-oriented and consistent  Common type system built-in  Extensible  Secure Common Language Runtime Base Classes ASP.NET DataDebug Win Forms …

28 Class Benefits  Increases developer productivity by reducing the number of APIs to learn  Enables cross language inheritance and debugging  Makes it easy to add or modify framework features  Allows creation of secure applications  Integrates well with tools

29 Active Server Pages.NET  Web Forms and Web Services  components separate code from content  Provides factored architecture  Compiled  No-touch deployment system  Intelligent state management  Backwards compatible with ASP Common Language Runtime Base Classes ASP.NET Web Forms Web Services

30 ASP.NET Benefits  Developer productivity increases  Tools easily use ASP.NET  Any programming language  VB.Net, JScript, C++, COBOL, Eiffel, Perl, etc.  40% to 70% reduction in lines of code  Application performance increases  Simple deployment (e.g., with XCOPY)  Reliability, resilience increase  Easy to extend or replace features  Session state scales to Web Farms  Controls sense client and adapt output  HTML, DHTML, WML

31 ECMA  CLI – Common Language Infrastructure  A subset of the full CLR  A subset of the Framework class libraries  CIL – Common Intermediate Language  The Full Intermediate Instruction Set  C#  The Full C# Language Specification

32 ECMA TG3 Specifications  CLI Partition I - Architecture  CLI Partition II – Metadata  CLI Partition III - CIL  CLI Partition IV - Library  CLI Partition V - Annexes  Class Library 

33 Resources  Microsoft.NET Framework SDK  Community   Visual Studio   Mailing Lists 

34 Questions?

35

36 © ActiveState Corp PerlNET Jan Dubois

37 © ActiveState Corp Native Perl for.NET compiler?  We tried it:  Some runtime semantics impossible  XS Extension modules don’t work  Slow runtime  Looks like Perl, but not really compatible Just a different syntax for C # ?  Let’s try again with Perl 6

38 © ActiveState Corp PerlNET Overview  Interface with standard Perl interpreter  Advantages  Runs at normal speed  Complete Perl language support  Full support for extensions  Disadvantages  Heavyweight components  Moving between Perl and.NET is slower

39 © ActiveState Corp How does it work?  Interface specifications in Perl source  PerlNET creates.NET proxy objects  Proxies use P/Invoke to call Perl  Perl uses COM interop to call.NET  Runtime layer marshals data

40 © ActiveState Corp PerlNET Component Perl Host Perl Module Proxy Managed Runtime Module.pm.NET FrameworkWindows.NET Interface

41 © ActiveState Corp PerlNET Sample Code

42 © ActiveState Corp Sample Code Metadata

43 © ActiveState Corp C # Program using PerlNET

44 © ActiveState Corp Challenges  Method overloading  Exception handling  Garbage collection  Efficient data marshaling

45 © ActiveState Corp Supported.NET Features  Constructors & Inheritance  Methods incl. overloading  Fields, Properties & Indexers  Events (Delegates)  Enumerations  Exceptions  Custom attributes  Namespaces  P/Invoke

46 © ActiveState Corp PerlNET Capabilities  Language interoperability  WinForms  ASP.NET  Web Services  Visual Studio.NET integration

47 © ActiveState Corp Using PerlNET Eric Promislow, ActiveState

48 © ActiveState Corp Gains String Processing & Regular Expressions Network Connectivity Databases CPAN.NET COM Automation Win32 API Pure Perl

49 © ActiveState Corp “PerlPad” Adding juice to a notepad-like editor with back-end Perl scripting Find RegEx Search & Replace RegEx Use “ee” mode on substitution operator

50 © ActiveState Corp Simple step-through example C# client Perl component For debugging: Make Perl project start-up Debugging:Debug Mode: MultiLang Build:Command-line: Add “-d” Set breakpoints, go


Download ppt "Camel Crossings: Perl & the Microsoft.NET Framework Brad Merrill, Microsoft Jan Dubois, ActiveState Eric Promislow, ActiveState."

Similar presentations


Ads by Google