trusted components
play

Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand - PowerPoint PPT Presentation

1 Last update: 2 November 2004 Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand Meyer Dr. Karine Arnout Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26 2 Lecture 26:


  1. 1 Last update: 2 November 2004 Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand Meyer Dr. Karine Arnout Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  2. 2 Lecture 26: Component model: The .NET example Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  3. Agenda for today 3 � What is .NET? � C# basics � Eiffel for .NET Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  4. What .NET is not? 4 � NOT a programming language: � “ C# is not .NET and .NET is not C# ” � NOT an operating system (yet). Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  5. What .NET is… 5 � An open-language platform for enterprise and Web development. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  6. The scope of .NET 6 � .NET addresses almost everyone: � The general public � New user-friendly services � Businesses � Help improve “B2B” relationships. � Developers � Security � Programming-language interoperability � Component-based development � Versioning � Memory management Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  7. The .NET architecture 7 Web services UDDI, WSDL, Passport Open interchange formats XML & SOAP Frameworks & libraries ASP.NET, Windows Forms, Remoting… C#, Visual Basic.Net, Managed C++, Cobol, Specific language compilers Eiffel for .NET… Language interoperability Common Language Specification (CLS) Development environment Visual Studio.Net Compilation, execution… Common Language Runtime (CLR) Underlying platform Hardware, Operating system, database system Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  8. The Common Language Runtime 8 � Basic set of mechanisms to execute .NET programs. � Virtual machine based on internal code: MSIL. � MSIL: not interpreted but “jitted” to native platform. � Built-in security mechanisms. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  9. The .NET execution model 9 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  10. .NET specific vocabulary 10 � Managed code: Native code for the target platform, intended to run under the control and with the help of the CLR. � Ex: C# , Eiffel for .NET, Managed C+ + � Unmanaged code: Native code that doesn’t rely on the CLR. � Ex: “Classic” Eiffel, Unmanaged C+ + Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  11. The assembly 11 � Compiled form of a set of classes � The .NET unit of reuse (“.exe” or “.dll”) � May be shared or private. � Notion of Global Assembly Cache � Contain: � MSIL code (not binary code) � Metadata (interface information) � Can be viewed with ILDasm. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  12. The Global Assembly Cache 12 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  13. .NET core assembly (mscorlib.dll) 13 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  14. .NET libraries (1/ 2) 14 Nam espace W hat for? System Basic types: Int32, String … System.Collections Collection types: ArrayList… System.Data Relational database management System.Drawing GDI graphics System.Net Network communications System.Runtime.Remoting Distributed computing System.Security Security features Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  15. .NET libraries (2/ 2) 15 Nam espace W hat for? System.Text ASCII, Unicode, etc. encoding System.Text.RegularExpressions Regular expressions handling System.Threading Thread support System.Timers Raising time-controlled events System.Web.UI.WebControls Graphical Web controls System.Windows.Forms Graphical controls: Button… → See the Reference documentation for more information. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  16. Towards new services… 16 A (demo) conference registration page Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  17. Successful registration 17 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  18. Passing erroneous data 18 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  19. About this demo… 19 � Some of what this demo illustrates: � ASP.NET (Active Server Pages .NET) � Server-side mechanisms, server controls � Debugging Web applications like traditional ones � Our first C# example… � Multi-language development (C# , Eiffel for .NET) Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  20. The ASP.NET source 20 Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  21. Multi-language support 21 C++ C# Eiffel ... Framework Windows Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  22. Languages on .NET (1/ 3) 22 � “Microsoft languages” � Visual Basic.Net � C# � Managed C+ + � Jscript � Commercial languages (see next) � Research languages (see next) Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  23. Languages on .NET (2/ 3) 23 � Commercial offerings from 3 rd parties: � Cobol (Fujitsu) � Eiffel for .NET (Eiffel Software) � Smalltalk (QKS) � Java (JUMP program) � Perl, Python (ActiveState) � APL (Dyadic) � Fortran (Fujitsu) � Fortran (Salford Software) Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  24. Languages on .NET (3/ 3) 24 � Research languages: � CAML (INRIA) � Mercury (Melbourne Uni.) � Scheme � Oberon (ETH, Zürich) � Component Pascal (QUT) � Haskell (Universities, Microsoft Research UK) Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  25. Full interoperability 25 � Cross-language… � Inheritance � Classes can inherit from each other, regardless of language of origin. � No need for wrappers � No IDL � Debugging sessions � In Visual Studio.Net � Exceptions Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  26. Full interoperability: the price to pay… 26 � Must conform to the .NET object model (VOS, Virtual Object System ): � The type system � Object-oriented principles (type, inheritance) � Too much for some (non-O-O languages) � Too little for some: multiple inheritance (Eiffel) � Difficult features: overloading � Must observe the Common Language Specification (CLS) Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  27. Common Language Specification 27 � Set of rules – more restrictive than the .NET object model – to determine compatibility. � Part of the ECMA standard � Three levels: � Producer (“framework”) � Consumer � Extender Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  28. CLS rules example 28 (Overloading) “Methods and events that have the same name must be distinguished by at least one argument type.” � Producer: Must mark any offending methods/ events as non-CLS-compliant. � Consumer: Need not accept types that violate these rules, except if marked non-compliant. � Extender: Need not provide syntax for defining types that violate this rule. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  29. The .NET type system 29 Type Reference Value Class Interface Pointer User- Built-in defined Name- Structure- equivalent equivalent Integer Enums type Managed Boxed Unmanaged value type Floating Function Array type Boxed Delegate enum Typed ref Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  30. Value vs. reference types 30 � Value types denote values (simple value or objects). � Reference types denote location of values. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  31. Simple value vs. object 31 � A simple value cannot by itself identify its A simple value 342 type. � Ex: int32, float 32 � An object carries its An object Type info own type description. 342 Fields "A string" Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

  32. Value vs. reference types 32 � Every value type has a corresponding reference Type info type: its “boxed” version. Boxed 342 � Some reference types have a corresponding value type: an “unboxed” version. Unboxed 342 � Limitation: Inheritance and interfaces apply only to reference types. Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend