1 / 38

Introduction to .NET and Eiffel for .NET

Introduction to .NET and Eiffel for .NET. Karine Arnout Chair of Software Engineering – Bertrand Meyer ETH Zurich, Switzerland Karine.Arnout@inf.ethz.ch. Presentation outline. What is .NET? Eiffel for .NET. Presentation outline. What is .NET? Eiffel for .NET. What .NET is not?.

temima
Download Presentation

Introduction to .NET and Eiffel for .NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to .NET and Eiffel for .NET Karine Arnout Chair of Software Engineering – Bertrand Meyer ETH Zurich, Switzerland Karine.Arnout@inf.ethz.ch ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  2. Presentation outline • What is .NET? • Eiffel for .NET ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  3. Presentation outline • What is .NET? • Eiffel for .NET ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  4. What .NET is not? • NOT a programming language: • “C# is not .NET and .NET is not C#”. • NOT an operating system (yet). ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  5. What .NET is… • An open-language platform for enterprise and Web development. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  6. The scope of .NET • .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 ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  7. The .NET architecture Web services UDDI, WSDL, Passport Openinterchange formats XML & SOAP Frameworks &libraries ASP.NET, Windows Forms, Remoting… C#, Visual Basic.Net, Managed C++, Cobol, Eiffel for .NET… Specificlanguagecompilers Languageinteroperability Common Language Specification (CLS) Development environment Visual Studio.Net Compilation,execution… Common Language Runtime (CLR) Underlying platform Hardware, Operating system, database system ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  8. The Common Language Runtime • Basic set of mechanisms to execute .NET programs. • Virtual machine based on internal code: CIL. • CIL: not interpreted but “jitted” to native platform. • Built-in security mechanisms. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  9. The .NET execution model ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  10. .NET specific vocabulary • 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++ ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  11. The assembly • 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 • Contains: • CIL code (not binary code) • Metadata (interface information) • Can be viewed with ILDasm. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  12. The Global Assembly Cache ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  13. .NET libraries (1/2) ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  14. .NET libraries (2/2) → See the Reference documentation for more information. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  15. Towards new services… ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  16. Successful registration ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  17. Passing erroneous data ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  18. About this demo… • 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) ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  19. Multi-language support C++ C# Eiffel ... Framework Windows ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  20. Full interoperability • 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 ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  21. Full interoperability: the price to pay… • 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) • Set of rules – more restrictive than the .NET object model – to determine compatibility. • Now a standard: ECMA, ISO. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  22. Type Value Reference Pointer Class Interface User-defined Built-in Structure-equivalent Name-equivalent Integertype Enums Unmanaged Managed Boxed value type Array Function Floatingtype Delegate Boxed enum Typedref The .NET type system ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  23. Presentation outline • What is .NET? • Eiffel for .NET ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  24. Design by Contract on .NET • Like Eiffel, Eiffel for .NET directly enforces Design by Contract, which addresses: • Correctness • Documentation • Debugging and testing • Inheritance control • Management • Eiffel for .NET is the sole language on .NET to natively support contracts. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  25. Eiffel for .NET • Full implementation of Eiffel on .NET: • Design by Contract • Seamlessness of software development • Multiple inheritance • Genericity… • Large set of libraries: • Eiffel libraries + .NET libraries • Directly available in EiffelStudio • Integrated into Visual Studio.NET: Eiffel ENViSioN!™ • Smart editor • Project clusters browsing… ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  26. ISE EiffelStudio ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  27. Multiple inheritance and genericity… • … Or how to map non-CLS compliantmechanisms on .NET while preserving languageinteroperability? ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  28. Create.A Create.B Create.C A B Impl.A Impl.B C Impl.C Multiple inheritance on .NET • How Eiffel for .NET does it: • Taking full advantage of interfaces and namespaces. Shadowing classes with interfaces. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  29. “Hello World!” with Eiffel for .NET class HELLO_WORLD create make feature {NONE} -- Initialization makeis -- PrintHello_world_message. do io.put_string (Hello_world_message) end feature -- Constant Hello_world_message:STRINGis“Hello World!” --Hello World! message end ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  30. Full interoperability on .NET (1/4) • With C#: public class HelloWorld1 { public static void Main() { HelloWorld sample; sample = Create.HelloWorld.Make(); } } ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  31. Full interoperability on .NET (2/4) • With VB.NET: Public Class HelloWorld1 Public Sub Main () Dim sample as HelloWorld sample = Create.HelloWorld.Make() End Sub End Class ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  32. Full interoperability on .NET (3/4) • With C#: using System; public class HelloWorld2: Impl.HelloWorld { public static void Main() { HelloWorld2 h2; h2 = new HelloWorld2(); Console.WriteLine (h2.HelloWorldMessage()); } } ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  33. Full interoperability on .NET (4/4) • With VB.NET: Imports System Public Class HelloWorld2 Inherits Impl.HelloWorld Public Shared Sub Main() Dim h2 as HelloWorld2 h2 = new HelloWorld2() Console.WriteLine (h2.HelloWorldMessage()) End Sub End Class ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  34. C#: A step forward • Smooth transition from Java to .NET • Similar syntax • A step forward • Strong type system, event-handling, … • Not the silver bullet • Sometimes too complicated (delegates) • No native support for contracts • No genericity • No multiple inheritance Eiffel for .NET is definitely better! ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  35. Research work • Extraction of contracts from .NET libraries: • Study of the .NET Collections library • Development of a CIL parser to extract preconditions automatically • Contract Wizard to add contracts to a .NET assembly a posteriori ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  36. References: About .NET and Eiffel for .NET • Karine Arnout: Introduction to Eiffel for .NET. CoDe Magazine, Sept / Oct 2002. • Bertrand Meyer: The .NET Training Course. Prentice Hall, 2001. • Bertrand Meyer, Raphaël Simon, Emmanuel Stapf: Instant .NET. Prentice Hall, 2002 (in preparation). • Microsoft: .NET Reference documentation. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/cpref_start.asp. • .NET Experts: http://www.dotnetexperts.com • Raphaël Simon, Emmanuel Stapf, and Bertrand Meyer. “Full Eiffel on .NET”. MSDN, July 2002. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/pdc_eiffel.asp. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  37. References: About contract extraction • Karine Arnout, and Raphaël Simon. “The .NET Contract Wizard: Adding Design by Contract to languages other than Eiffel”. TOOLS 39. IEEE Computer Society, July 2001, p 14-23. • Karine Arnout. “Extracting implicit contracts from .NET libraries”, GCSE Young Researchers Workshop, NET.OBJECT DAYS, 7-10 October 2002, Erfurt, Germany. • Karine Arnout. “Extracting Implicit Contracts from .NET Libraries”, OOPSLA 2002 (Poster session), Seattle USA, 4-8 November 2002, OOPSLA'02 Companion, ACM, p 104-105. • Karine Arnout, and Bertrand Meyer. “Finding Implicit Contracts in .NET Components”, to appear in Formal Methods for Components and Objects (FMCO), eds. Frank de Boer et al., Springer-Verlag, 2003. ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

  38. Any Questions? Karine.Arnout@inf.ethz.ch http://se.inf.ethz.ch/people/arnout ECOOP, .NET: The programmer's perspective - Darmstadt, July 2003

More Related