A Registration Page Demo
|Figure 9: An Eiffel for .NET Web service (conference registration page).|
This demo represents a registration service for a conference. It provides two main pages: a registration page for attendees (see Figure 9
) and a status page showing the current state of registrations (for the organizers of the conference).
is an extract of the underlying ASP.NET code.
This ASP.NET implementation contains HTML code (for the Web page layout) and C# code.
The following line tells you that the code written in the <SCRIPT> section is in C#:
<%@ Page Language="C#" %>
In the HTML section (which does not appear in Listing 5
), we find:
<ASP:Button ID="Register" TEXT="Register"
OnClick="Register_Click" RUNAT="SERVER" />
This code means that the code behind the Register_Click
event (see Listing 5
) is called whenever you click the Register
Consider the Register_Click
method: it uses a variable registrar
of type Registrar
, which is not defined in the ASP.NET page itself but is imported from an external component called RegistrationService
. This is shown in the second line of Listing 5
<%@ Import Namespace="RegistrationService" %>
is an Eiffel for .NET assembly, and Registrar is an Eiffel for .NET class:
description: "Registration services, include%
%adding new registrants%
%and new registrations."
We find the features add_registrant
used in the C# code of the <SCRIPT> section (see Listing 5
feature -- Basic Operations
add_registrant (address_form, first_name,
address, city, state, zip,
-- Add new registrant.
add_registration (registrant_id: INTEGER;
quantity, discount_plan: STRING;
preconf, wet, conference,
esummit, postconf: BOOLEAN)
-- Add new registration.
A strong feature of ASP.NET development is the ability to debug Web pages. Figure 10
demonstrates these debugging features in action.
ASP.NET Pages with Eiffel
The previous example showed how to build a Web service involving Eiffel for .NET components and an ASP.NET page written in C#. With the forthcoming release of EiffelStudio 5.2, you will be able to incorporate Eiffel code with a simple directive. For example, it will be possible to write:
<%@ Page Language="Eiffel" %>
This enables you to integrate ASP.NET pages directly with Eiffel for .NET, without having to use some C# workarounds to achieve it (as it was still the case in 5.1). Listing 6
shows the Eiffel for .NET implementation of the previous registration page example.
Eiffel for .NET, available as part of ESI's EiffelStudio delivery, takes advantage of two innovative object-oriented technologies: Eiffel and .NET.
Like Eiffel, Eiffel for .NET provides full support for Design by Contract, multiple inheritance, genericity and seamlessness between the different steps of the software lifecycle. Eiffel for .NET users can also benefit from the facilities provided by the Eiffel development environment EiffelStudio: complete reverse engineering with the Diagram Tool, syntax highlighting of the Eiffel text, smart auto-completion of class and feature names, pick-and-drop mechanisms to navigate easily between classes, etc.
Like other .NET programming languages (C#, VB.NET, Perl and Python), Eiffel ENViSioN! is integrated in the Microsoft Visual Studio .NET development environment, providing users with flexibility of the toolset. This gives developers the possibility to choose the development model that best fits their project needs: EiffelStudio for Eiffel-based (possibly multi-platform) programming or Visual Studio .NET for multi-language development.
|Both .NET and "pure" Eiffel libraries are available to Eiffel for .NET users, encouraging reusability in software construction.|
Additionally, Eiffel for .NET is fully interoperable on the .NET platform: both .NET and "pure" Eiffel libraries are available to Eiffel for .NET users, encouraging reusability in software construction. I mentioned the case of Windows Forms, but the actual scope goes far beyond. Internet software developers can also reuse Eiffel for .NET components in their ASP.NET pages to build advanced and powerful Web services.