Presentation is loading. Please wait.

Presentation is loading. Please wait.

DEV345 Comparing.NET and Java David Chappell Principal Chappell & Associates www.davidchappell.com.

Similar presentations


Presentation on theme: "DEV345 Comparing.NET and Java David Chappell Principal Chappell & Associates www.davidchappell.com."— Presentation transcript:

1 DEV345 Comparing.NET and Java David Chappell Principal Chappell & Associates www.davidchappell.com

2 Standard Library Application Platforms Today Operating System Runtime Environment Browser Apps Web Services Apps Other Apps Local Apps GUI Services Transaction Services Web Scripting Data Access MoreRemote Access

3 DEV349 The Microsoft.NET component model Bertrand Meyer Professor of Software Engineering, ETH Zürich Scientific advisor, Eiffel Software, Santa Barbara

4 Component development with COM and CORBA Component “ Bus ” Server component Client component IDL Stub

5 IDL spec module Reservation {interface Flight_booking { Price ticket_price (in Date day, in Flight number) raises (invalid_date, invalid_number); exception invalid_date {Date when; }; readonly attribute string name;...} };

6 The role of IDL Provide language-neutral interface description of a module’s operations As a result, enable clients and suppliers written in different implementation languages

7 The trouble with IDL Programmers must write IDL interface in addition to actual software If from an O-O language, IDL duplicates information present in the code, e.g. C++ header file, Eiffel contract form Perils of duplication IDL compiler goes the wrong way! However: some tools ease the process.

8 Pre-.NET approaches: summary Object technology is best known basis Information hiding is key O-O sufficient by itself: need for autonomous components Current approaches too heavy: extra work to turn module (e.g. class) into component IDL is a killer

9 DEV200.NET Framework Overview Chris Anderson Software Architect,.NET Client Microsoft Corporation

10 .NET Framework Design Goals Dramatically simplifies development and deployment Unifies programming models Provides robust and secure execution environment Supports multiple programming languages

11 Framework, Languages, And Tools Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services Mobile Internet Toolkit WindowsForms Common Language Specification VBC++C#JScriptJ# Visual Studio.NET

12 Framework, Languages, And Tools Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services Mobile Internet Toolkit WindowsForms Common Language Specification VBC++C#JScriptJ# Visual Studio.NET

13 The.NET Evolution Before COM, applications were completely separate entities with little or no integration Applicatio n Code and data structures

14 The.NET Evolution COM provides a way for components to integrate; However, each component must provide the “plumbing” and objects cannot directly interact

15 The.NET Evolution With the.NET Framework common language runtime, components are built on a common substrate; No “plumbing” is needed and objects can directly interact

16 Assembly Compilation And Execution Source Code Language Compiler Compilation At installation or the first time each method is called Execution JIT Compiler NativeCode Code (IL) Metadata

17 Simplify Development Completely eliminates COM plumbing No more… –Registration –GUIDs –.IDL files –HRESULTs –IUnknown –AddRef/Release –CoCreateInstance =>self described apps =>hierarchical namespaces =>unified object model =>structured exceptions =>common root object =>garbage collector =>”new” operator

18 Simplify Development Common Type System –Common instance and type definition Enables clean OO programming –Classes and interfaces –Constructors, properties, methods, events –Cross language inheritance Built-in interoperability –With COM –With native (Win32 ® style) DLLs

19 Robust Environment Automatic lifetime management –All objects are garbage collected Exception handling –Error handling first class and mandatory Type-safety –No buffer overruns, No unsafe casts, Uninitialized variables

20 Secure Environment Security designed-in Code access security enforcement –Security based on the identity of code –Administratively configurable via policy ASP.NET integrated authentication of user –Windows identity, Passport ®, forms-based, … Cryptography library with XML DSIG support –Digital signature for XML (www.w3.org/signature)www.w3.org/signature

21 Simplify Deployment And Management Zero-impact install –Applications and components can be shared or private Side-by-side execution –Multiple versions of the same component can co- exist on a system Assemblies –Contain dependency information

22 Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services Mobile Internet Toolkit WindowsForms Common Language Specification VBC++C#JScriptJ# Visual Studio.NET Framework, Languages, And Tools

23 Unify Programming Models Windows API.NET Framework Consistent API availability regardless of language and programming model ASPStateless, Code embedded in HTML pages MFC/ATLSubclassing,Power,Expressiveness VB Forms RAD,Composition,Delegation

24 How Much Simpler? Windows API HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window", 0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain);.NET Framework Dim form As New Form() form.Text = "Main Window" form.Show()

25 Factored And Extensible The Framework is not a “black box” Any.NET class is available for you to extend through inheritance –Gives developers much more head room Plug and Play components and subsystems

26 The.NET Framework Library Base Class Library ADO.NET and XML Web Forms Web Services Mobile Internet Toolkit WindowsForms ASP.NET

27 System System.DataSystem.Xml System.Web Globalization Diagnostics Configuration Collections Resources Reflection Net IO Threading Text ServiceProcess Security Common OleDb SQLTypes SqlClient XPath XSLT Runtime InteropServices Remoting Serialization Serialization ConfigurationSessionState CachingSecurity Services Description Discovery Protocols UI HtmlControls WebControls System.Drawing Imaging Drawing2D Text Printing System.Windows.Forms DesignComponentModel The.NET Framework Library

28 Base Framework System Threading Text ServiceProcess Security Resources Reflection Net IO Globalization Diagnostics Configuration Collections Runtime Serialization Remoting InteropServices

29 Data And XML System.Data System.Xml SQLTypes SQLClient Common OleDb Serialization XPath XSLT

30 ASP.NET System.Web Caching Configuration ServicesUI SessionState HtmlControls WebControls Description Discovery Security Protocols

31 Windows ® Forms System.Drawing Drawing2D Imaging Printing Text System.Windows.Forms DesignComponentModel

32 Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services Mobile Internet Toolkit WindowsForms Common Language Specification VBC++C#JScriptJ# Visual Studio.NET Framework, Languages, And Tools

33 Languages The.NET Platform is language neutral –All.NET languages are first class players –You can leverage your existing skills Common language specification –Set of features guaranteed to be in all languages We are providing –Visual Basic ®, C++, C#, J#, JScript ® Third-parties are building –APL, COBOL, Delphi, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…

34 Standardization A subset of the.NET Framework and C# submitted to ECMA –Adopted as International standards in Dec. 2001 –In the ISO fast-track process now –Co-sponsored with Intel, Hewlett-Packard Common language infrastructure –Based on common language runtime and base framework –Layered into increasing levels of functionality

35 Summary The.NET Framework –Dramatically simplifies development and deployment –Unifies programming models –Provides robust and secure execution environment –Supports multiple programming languages

36 DEV349 The Microsoft.NET component model Bertrand Meyer Professor of Software Engineering, ETH Zürich Scientific advisor, Eiffel Software, Santa Barbara

37 Execution scheme under.NET IL code (plus metadata ) Loader Managed code Unjitted routine call Execution Language compilers JIT + verifier Eiffel VBC++ C#.NET languages

38 The basic.NET component unit Result of compilation is an assembly Assembly is a set of classes Unit of: Delivery and deployment Naming (through namespaces) Security (level for granting permissions) Versioning & side-by-side execution Self-documenting through “manifest”

39 The Single Product Principle There is one product: SOFTWARE Eiffel: use single, seamless notation throughout the development cycle Rely on tools to produce documentation Maintain just one product!

40 Single Product Principle in.NET It’s all in the metadata! Definition: Metadata is information about a module’s external properties, not necessarily needed for executing the module, but retained after compilation along with the binary code

41 Examining an assembly with ildasm

42 How is the metadata stored? Stuffed into PE (Portable Executable) format To Windows, result of compiling an assembly looks like ordinary binary (*.dll or *.exe), but contains all kinds of supplementary information Will execute on.NET only

43 The Portable Executable (PE) format

44 Execution model: the role of metadata IL code (plus metadata ) Loader Managed code Unjitted routine call Execution Language compilers JIT + verifier Eiffel VBC++ C#.NET languages

45 Metadata contents Manifest: assembly description –Name, version, culture –Security properties: Needed permissions –Public key if present –Dependencies on other assemblies List of classes For each class: –Features: methods, fields, properties, events –Signatures (argument and result types) of each –Interfaces it implements Custom attributes (see next)

46 Working with metadata Letting a program access metadata: Use System.Reflection Examining metadata interactively: Use ILDasm Can convert metadata to: XML COM type libraries (regasm) To produce metadata: Use System.Reflection.Emit

47 .NET component model Single product principle: full reflectivity; assemblies are self-documenting (Groups of) classes directly yield components No extra plumbing No IDL Full application of Object-Oriented principles Multi-language interoperability


Download ppt "DEV345 Comparing.NET and Java David Chappell Principal Chappell & Associates www.davidchappell.com."

Similar presentations


Ads by Google