SOFTWARE TECHNOLOGIES

the focus of the technology—it’s simply the means to an end, the basic notation for .NET Is Coming programming the .NET runtime. Technically, C# looks very much like Java, with extensions similar to mecha- Bertrand Meyer, Interactive Software Engineering nisms found in Delphi and ’s Visual J++. These extensions include “properties”—an attempt to remedy This month’s contribution to Software Technologies discusses the emergence of Java’s information-hiding deficiencies— Microsoft’s .NET platform for Web services. While it is significantly longer than the and an event-driven programming model standard for the department, I argued that the additional length is warranted because using the notion of “delegates”—object this technology promises to have significant, wide-ranging effects on software devel- wrappers around functions—that are opment, and the editorial staff concurred. We all hope that readers will be as inter- appropriate for graphical user interface ested in this development as we are. and Web applications. Michael Lutz, Area Editor While it is likely to become a serious competitor to Java, C# is not an attempt nnounced in July 2000, .NET, connected bike at the gym, you can effort- to replace all existing languages. In fact, Microsoft’s platform for lessly change both your evening’s restau- Microsoft’s own investment in Visual XML-based Web services, is rant reservation and babysitter while Basic (recent estimate: 6 million devel- A currently undergoing a succes- pedaling away without missing a beat. If opers) and C++ would make such a goal sion of beta versions for a pro- the aim is to set lofty ideals for the next self-defeating. jected release late this year or early in 2002. .NET has a central role in Micro- soft’s strategy to integrate the Internet, .NET, an open language enterprise and Web services, building block services, numerous tools for developers, and Web development platform, has the many other features. Curiously though, this next generation potential to dominate the computing of software hasn’t grabbed the comput- industry for years to come. ing world’s attention as Java did in its heyday. Yet, in many respects, .NET is a more important phenomenon. The busi- ness press, for its part, hasn’t missed the generation, this example is admittedly Instead, a distinctive characteristic of technology’s significance. Both Business underwhelming, but since when are tech- .NET is its language neutrality. In addition Week (cover story, 30 Oct. 2000) and nical journalists supposed to judge new to Microsoft-supported languages, .NET The Economist (January 2001) have technologies by press releases? is open to many others including Cobol, devoted major coverage to .NET. Others have been more perspicacious. Eiffel, Fortran, Perl, Python, Smalltalk, For example, the Patricia Seybold Group and a host of research languages from ML A FAILURE OR THE FUTURE? wrote that “.NET is a leading example to Haskell and Oberon. Unlike others in Perhaps it is .NET’s breadth of cover- of what we believe will be the dominant the industry, Microsoft isn’t trying to con- age that has puzzled some technical architectural model for the third genera- vert the world to a new language. observers and made them wonder tion of Internet applications” and that it whether there was anything beyond the has “ominous implications for a large .NET ARCHITECTURE hype. One observer who doesn’t think so number of Microsoft competitors.” So what is .NET? A general definition is John Dvorak, who in his November might be: “An open language platform 2000 PC Magazine column wrote that WHAT .NET ISN’T for enterprise and Web development.” .NET is “surrounded by too many buzz- In describing .NET, it’s useful first to The aim is to provide an abstract words and generalities to be under- point out what it is not. It’s neither an machine for professional developers, cov- standable. I’m not sure the company operating system nor a programming lan- ering both traditional IT—client-server, knows what .NET is, or whether any- guage. Microsoft operating systems con- n-tier—and Web-oriented applications. body does. It has the onerous smell of tinue their own evolution—Windows Figure 1 shows the six layers of the plat- failure about it already.” 2000, Me, XP, CE for embedded devices— form’s overall structure. The basis for this indictment seems to although you can expect more .NET bits Web services. The top layer provides be a Microsoft public relations document to filter down into the base OS. As for pro- .NET users—persons and companies— describing an exciting future in which— gramming languages, .NET has intro- with Web services for e-commerce and thanks to .NET—from your Web- duced a new one, C# (C-sharp), but it’s not business-to-business applications.

92 Computer Frameworks and libraries. A set of frameworks and libraries provides the most immediately attractive aspect for Web services developers. These include ASP.NET, active server pages for developing smart Web Frameworks and libraries: sites and services; ADO.NET, an XML- ASP.NET, ADO.NET, Window Forms based improvement to ActiveX Data Interchange standards: Common development tools: Objects, for databases and object-rela- SOAP, WSDL Visual Studio.Net tional processing; and for graphics. Altogether, .NET contains Component model thousands of reusable components. Object model and common language specification Interchange standards. XML-based interchange standards serve as a plat- form-independent means of exchanging objects. The most important are SOAP (simple object access protocol), an Figure 1. Elements of the .NET architecture. Microsoft’s Web development platform consists of increasingly popular way to encode six layers from the user-visible Web services to the internal object model and common language objects, and WSDL (Web Services runtime. Description Language). Development environment. The new set of mechanisms for executing .NET drag and drop to input validation, Visual Studio.Net provides the tool of programs regardless of their language of Web controls facilitate building Web most direct use to developers: A common origin: translation to machine code (judi- pages that look like a modern non- software development environment offer- ciously incremental translation, or “jit- Web GUI. ing facilities for development, compila- ting”), loading, security mechanisms, • The Web controls, handled by de- tion, browsing, and debugging shared by memory management (including garbage fault on the server side, yield many languages. This environment, an collection), version control, and inter- browser-dependent rendering—out- outgrowth of Visual Studio extended facing with non-.NET code. put that is automatically tailored to with an application programming inter- .NET provides these capabilities over the browser. Some operations can be face, not only supports Microsoft-imple- a broad spectrum of hardware and soft- processed on the client side—for mented languages such as Visual C++, ware platforms, ranging from very high- example, if the Web site visitor is Visual Basic, and C# but also allows end servers and Web farms to PCs, using a recent version of Internet third-party vendors to plug in tools and phones, PDAs, other wireless devices, Explorer or the browser supports compilers for other languages. and Internet appliances. dynamic HTML or JavaScript. In Component model. Before .NET there the default case, the server handles were already three major contenders for .NET BENEFITS the interaction and renders every- leadership in the field of models and stan- Users and developers can expect thing as plain HTML. dards for component-based development: numerous benefits from the spread of • ASP.NET accomplishes one of the Corba from the Object Management .NET. For many, the most impressive most delicate aspects of Web request Group, J2EE from Sun, and Microsoft’s component will be the ASP.NET frame- processing: maintaining a client’s COM. .NET brings in one more model, work. ASP.NET is not an incremental state. HTTP is a stateless protocol, based on object-oriented ideas: With update of the ASP (active server pages) but any realistic Web interface—a .NET you can build “assemblies,” each technology available on Windows. It is a shopping basket, for example—must consisting of a number of classes with new development that provides tools for retain client information from one well-defined interfaces. The model is quite building smart Web sites with extensive page display to the next. ASP.NET different from COM, although it provides associated programming facilities. An maintains session state without stor- a transition path; its major attractions are ASP.NET demo at http://dotnet.eiffel. ing client information on the server, its simplicity and the absence of an IDL com, Interactive Software Engineering’s thereby freeing developers from (Interface Description Language). Web site devoted to Eiffel under .NET, using cumbersome manual tech- Object model. The object model pro- illustrates some of the framework’s most niques such as URL encoding, hid- vides the conceptual basis on which attractive aspects. den fields, and cookies. It can everything else rests, in particular, .NET’s accomplish this both on a single OO type system. The common language • ASP.NET’s Web controls provide a server and across Web farms. specification defines restrictions ensuring user interface similar to what is pos- • Through its connection to ADO. language operability. sible in today’s non-Web GUI envi- NET, which handles database con- Common language runtime. The com- ronments and far beyond what nections, ASP.NET enables setting mon language runtime provides the basic HTML offers as a default. From up part of a Web page to reflect the

August 2001 93 Software Technologies

contents of a database table directly, of .NET assemblies (program elements), all .NET code is subject to verifica- without manual intervention. Any- it is already an API. You can use a stan- tion that it obeys the object model’s one who has tried to code HTML dard API to receive stock quotes or news type system rules. For example, if tables displaying database contents updates, schedule a meeting based on you assign an expression to a vari- will appreciate this feature. your colleagues’ Web calendars, or able, the types must conform as • Because ASP.NET is directly tied to streamline your company’s purchasing determined by the inheritance hier- the .NET object model, compilers, process. archy. This precludes objects pre- and runtime mechanisms, the code Through its “Hailstorm” initiative, tending to be something other than associated with a Web page can be Microsoft is giving a major push to its what they are and rules out a whole part of an application, however com- “Passport” technology, already built-in class of security violations. plex, benefiting from mechanisms in Windows XP, enabling computer users • Origin verification. Any .NET as- such as security, versioning, and jit- to define a personal profile, make it avail- sembly can and usually should be ting, from the efficiency of .NET’s able as a set of Web services, and specify signed using 128-bit public key cryp- compiled approach, and from any who can use what parts of it. The aim is tography, which prevents imperson- .NET-supported languages. .NET’s to bring major simplifications to the ating another software source. versioning facilities allow on-the-fly many interactions we pursue with many • A fine-grained permission mecha- updates: Just replace a page with its different companies. nism. Each can specify the new version, and it will be automat- exact permissions that it requires its ically compiled the next time around, callers to have: file read, file read without the need to stop and restart ASP.NET removes the and write, DNS access, and others, the server. distinction between including new programmer-defined traditional software permissions. In addition, the “stack Closing the gap development and Web walk” mechanism ensures that if Perhaps ASP.NET’s greatest contribu- development. you require a permission, you tion is that it removes the distinction enforce it not only on direct callers between IT—traditional software devel- but also on their direct or indirect opment—and Web development. Web- callers—so that if A doesn’t have enabling an existing application can be a Microsoft, IBM, and other companies permission to call C, it can’t cir- major effort, and so can equipping a Web developed the SOAP XML-based format, cumvent this restriction by calling page, beyond pretty pictures, with ad- which exports .NET objects to the world B, who does have the permission. vanced processing. ASP.NET and .NET in at large. Microsoft and IBM are also devel- • A notion of “principal.” Software general have the potential for merging oping the Web Services Description elements can assume various roles these two disciplines. Language as a new standard for Web ser- during their lifetime, with each role Traditionally, companies have devel- vices. Sun recently endorsed both SOAP— giving access to specific security lev- oped software. In recent years, they have on which the company had previously sent els. This notion also includes both produced Web sites, initially little more mixed signals—and WSDL. Although predefined variants and program- than marketing brochures, but gradually many questions remain about this evolving mer-definable ones. acquiring more processing elements— aspect of .NET technology, there is a grow- CGI scripts, ASP, JavaScript, and so on. ing prospect of achieving true standards, VERSIONING Often, these sites are developed in an ad which would provide some of the Inter- For developers, rather than end users hoc fashion that does not benefit from the net’s biggest potential benefits. —although they will indirectly benefit— traditional IT experience on the other side .NET provides a simple but strong mech- of the house. With .NET, a Web page is a SECURITY anism that lets applications specify program, and a program can easily be- Microsoft’s .NET marketing empha- precisely what versions they can accept come a Web page. sizes the Web services part of the tech- for the modules they use. As a bonus, it’s easy to turn a Web inter- nology. But there is far more to .NET, in Thus far, Windows has offered two face into a traditional non-Web Windows particular a set of mechanisms intended extreme, unsatisfactory versioning poli- client GUI. Visitors to the ASP.NET demo for software developers rather than users. cies. With dynamic link libraries (DLLs), at http://dotnet.eiffel.com can download .NET’s security policy—a benefit to any version can, in principle, replace any the source code to see how to do this. both users and developers—is a systematic other. This leads to subtle incompatibili- attempt to shed the image of Windows as ties and “DLL hell”: An application WEB SERVICES having a poor security record. It combines installs a new DLL version that replaces .NET offers mechanisms that make a four major techniques: the previous one, with the sudden and Web page useful as both a human inter- mysterious side effect that some other face and an application program interface. • Type verification. When the site application doesn’t work any more. The Because an ASP.NET page is tied to a set administrator turns verification on, other extreme is COM, which avoids this

94 Computer situation, but at the expense of consider- ing any update as a new, incompatible version, which is not flexible enough. The .NET versioning model defines a standard version numbering policy and lets you specify what is acceptable for the assembly you need: a specific version number (“I want 4.5.2.1 and nothing else will do”), a certain range of versions (“4.5.whatever.whatever”), or the last one that worked. This should satisfy the basic versioning needs of many applications.

COMPONENT MODEL .NET also offers developers a new component model directly based on OO concepts. By removing the distinction between a program element and a soft- ware component, it provides significant benefits over technologies such as Corba and COM. Because an assembly provides a well-defined set of interfaces, other assemblies can use it directly. To turn a software element into a reusable component, Corba and COM require writing an interface description in a special IDL. .NET gets rid of IDL: You can use a .NET assembly directly as a component without any further wrap- ping because it is already equipped with the necessary information. The .NET component model is con- siderably simpler than COM, the previ- Figure 2. Examining an assembly originating in an Eiffel application with ILDASM, a graphical ous standard for component-based de- tool that analyzes metadata. velopment on Microsoft platforms. It does away not only with IDL but much number and types of arguments, whether can access the metadata via the of COM’s historical baggage, from the it’s a procedure or a function, and type Reflection library. Because the metadata HRESULT special type to low-level oper- of result, if any. is also available in XML format, any ations that keep track of references such Compilers for .NET-supported lan- application, whether it is part of .NET or as AddRef and Release, replacing it guages retain this information as meta- not, can obtain information about com- with garbage collection. Developers will data—the idea of producing self- ponents. appreciate this departure from COM, documenting components—in the gen- One example of a metadata applica- although in the short term the two mod- erated code. Metadata is not limited to tion is our “contract wizard,” which pro- els must coexist; COM Interop, an inter- predefined information. You can use cus- grammers can use to equip assemblies operability mechanism, should ease the tom attributes to specify essentially any compiled from languages other than transition. information for inclusion in the metadata Eiffel with Eiffel-like contracts. The pro- and keep it with the component after grammer uses the wizard to explore the SELF-DOCUMENTING COMPONENTS compilation. classes and their features, interactively The trick in removing IDL is to use Metadata is accessible in many ways. deciding to add contract elements—pre- interface information that is already pre- ILDASM (intermediate language disas- conditions, postconditions, class invari- sent in the source code, at least in an OO sembler) is a graphical tool that lets you ants. The wizard uses this input to language, where the program text con- visually examine an assembly’s interface generate a proxy assembly that imple- tains the list of classes in an assembly; the to obtain information from the meta- ments the contracts and call the noncon- list of each class’s features (routines/ data. Figure 2 shows an ILDASM screen tracted original component. It is not clear methods and attributes/field); and essen- for an assembly originating in an Eiffel how we could have produced such a tool tial information for each feature name, application. In addition, any program without metadata.

August 2001 95 Software Technologies

cepts. When a compiler generates MSIL C# VB C++ Eiffel .NET languages and associated metadata, it produces a .NET assembly that can potentially inter- act with any other assembly. Language compilers Interface rules Language interoperability comes at a MSIL code price: the CLS compatibility constraints. (plus metadata) Fortunately, those constraints only affect the modules that need to interact with Loader other languages, typically a small subset. All other modules, within a particular language, need not concern themselves JIT + verifier with the CLS. CLS compliance comes at three levels: Unjitted routine call Managed code • Supplier (oddly called “frame- work”): Others can consume what you produce. Execution • Consumer: Your modules can be clients of others’ producer-compli- ant modules. Figure 3. The .NET program execution model. The language compiler produces MSIIL code that • Extender: Your classes can inherit is translated further to native code. from classes in other languages.

LANGUAGE INTEROPERABILITY is a class, what is an object, how classes Typically, a .NET language compiler pro- Many companies have a significant can inherit from one another, and so on. vides the option of flagging each module software investment in different pro- Shortcomings. Some of its choices, as compliant or noncompliant at the gramming languages. .NET’s language obviously influenced by Java, are regret- desired level. interoperability is intended to avoid los- table. In particular, there is a clear-cut ing that investment. The level of inter- distinction between classes—fully imple- EXECUTION MODEL operability goes beyond what has been mented abstractions—and interfaces, .NET’s common language runtime available in previous efforts. For exam- which are specified only, with no actual provides a basic execution schema, ple, modules written in different lan- routines or attributes. Some of object shown in Figure 3. The language com- guages can both call each other and—in technology’s major benefits come from piler produces MSIL code, which is not the case of classes—inherit from each the ability to cover the full spectrum interpreted but is translated again, or jit- other, across languages. Debugging ses- from abstract specification and design to ted, to native code. Thus, the target plat- sions in Visual Studio.Net easily cross the most detailed and technical aspects form will execute only native code. language borders. This ability to mix lan- of implementation through a single guages without incurring costs for spe- notion of class, used as abstractly or con- Jitting cial wrappers or IDL makes it possible cretely as needed at any particular stage. With the default jitter, individual rou- for developers to choose the best lan- Also Java-like is the restriction of mul- tines are jitted on demand, as required guage for each part of an application, tiple inheritance to interfaces. The model by the execution, and then kept in their based on the expectation that it will currently does not support genericity, or jitted form. With EconoJit, a variant smoothly and automatically interface type-parameterized classes, but there are intended for small-memory-footprint with the other parts. plans to include a generic mechanism in devices, you can specify a maximum a later release. amount of space and apply a caching pol- The object model The .NET object model provides a icy to remove a jitted routine and make The object model and the common lan- coherent set of base concepts, based on a room for a new one. Another option is guage specification (CLS) are the basis of strongly typed OO policy. All language PreJit, which will perform the translation .NET’s language interoperability. The compilers generate an intermediate code, once for the entire application. object model is a set of concepts—simi- MSIL (Microsoft Intermediate Lang- lar to an OO language, but without the uage), a machine language for an abstract Managed code syntax or anything governing the pro- stack-oriented, OO machine that knows Code meant for execution by the gram’s external appearance and presen- about objects, inheritance, methods, .NET runtime is known as “man- tation—that defines the type system: what dynamic binding, and other OO con- aged”—it benefits from all the runtime’s

96 Computer Software Technologies

facilities such as garbage collection, Will we see .NET on non-Microsoft lead for long, but Microsoft has the exception handling, and security. Gar- operating systems? Although you cur- potential to stage a major coup. What- bage collection raises issues for C++, one rently need Windows to use .NET, late ever happens, .NET will affect nearly of the languages .NET offers. C++ has last year Microsoft submitted key parts everyone involved in any kind of enter- a lax type system that allows casts (con- of the technology for standardization to prise or Web development.✸ versions) between almost arbitrary ECMA, an international standardization types, but it contradicts the require- body. The elements still under discussion ments of safe GC. Indeed, classic C++ include the common language runtime, cannot generate managed code on .NET. CLS, MSIL, C#, and more than 1,000 Bertrand Meyer, CTO of Interactive For the corresponding classes, you have components from the basic libraries. Software Engineering, Santa Barbara, to use “Managed C++,” a new variant Microsoft is actively pushing to complete Calif. (http://www.dotnetexperts.com), of the language that imposes strong the work much faster than the usual time and an adjunct professor at Monash restrictions on type mixes and is in fact it takes for such standards processes. University, Melbourne, is the author of very close to C#. The recently announced The .NET Video Course (Prentice Hall, Microsoft is sending a strong signal to effort (http://www.go-mono.net) is in- 2001). Contact him at Bertrand_Meyer@ C++ developers indicating that full com- tended to develop an open-source imple- eiffel.com. patibility with C, the defining property of mentation of .NET, based on the ECMA classic C++, no longer meets software specifications and suitable for running on development demands in the Internet age. platforms such as Linux. Such efforts The combination of managed and unman- indicate that the transformation of .NET Meyer gratefully acknowledges the assis- aged classes offers a transition path. into a multiplatform development envi- tance of Raphaël Simon of ISE in prepar- ronment may happen faster than ex- ing this article. BEYOND WINDOWS pected. Only some .NET facilities are Windows-specific. The Windows Forms framework is intended to replace the n important technology develop- Editor Info: Michael J. Lutz, Rochester Insti- Windows graphical API and the graphi- ment, .NET has benefited from a tute of Technology, Department of Software cal part of Microsoft foundation classes A several-billion-dollar investment in Engineering, 134 Lomb Memorial Drive, (for C++), and ASP.NET is implemented research. Microsoft’s competitors haven’t Rochester NY 14623; (phone) +1 716 475 on top of Microsoft’s IIS Web server. missed the message, as indicated by sev- 2472; (fax) +1 716 475 7909; mikelutz@ Most of the rest of .NET could, in prin- eral recent announcements such as Sun’s mail.rit.edu ciple, be implemented on top of Linux, Open Net Environment. No one in this Solaris, or other systems. industry can be guaranteed to hold the

EDITORIAL CALENDAR

JANUARY/FEBRUARY JULY/AUGUST Usability Engineering in Fault Tolerance Software Development SEPTEMBER/OCTOBER MARCH/APRIL Software Organizational Global Software Development Benchmarking

MAY/JUNE NOVEMBER/DECEMBER Organizational Change Ubiquitous Computing

August 2001 97