The Best of Both Worlds: The Role of Mono in Multi-Platform Application Development

Have a Windows application, but want to port it to Linux? Mono lets you keep your source code and run on Linux, too. Mono founder Miguel de Icaza explains.

After a period of maturation and acceptance lasting several years and three releases, Microsoft.NET development has become commonplace, and is widely used to develop custom applications within enterprises. Over the last year,. NET was responsible for the majority of new enterprise IT development done on the Microsoft platform, and a 2005 survey by Forrester found that 56 percent of IT respondents in the enterprise favor. NET for development. Additionally, commercial applications from third parties and ISV’s written for the. NET Framework have become increasingly more commonplace.

Many development teams enjoy the productivity inherent in using Visual Studio and its wealth of tools for rapidly producing high-quality code. However, many teams would also like the ability to deploy on platforms other than Windows. In a recent FTP conference survey on Web application development and deployment, for example, developers overwhelmingly preferred working in Visual Studio, yet almost half wanted to deploy on multiple platforms, including platforms other than Windows.

Cross-platform application development is the role of the Mono Project (http://www.mono-project.com/), an open source implementation of the ECMA International standards that define the. NET platform. The standard defines an advanced runtime environment for running modern applications and a complete set of libraries for developing server and desktop applications. The Mono Project has two goals: to bring the same advanced features now available to Windows developers to Linux, Mac OS X, and other operating systems, and to assist Windows developers in bringing applications to Linux.

Novell is the main sponsor of the Mono project, supporting an open source model that enables other individuals and companies to contribute to Mono’s development. Novell and Mainsoft cooperate in an extensive research and development effort to enable technologies developed by Microsoft to run on Linux, and in Mainsoft’s case, the flagship Visual Studio development tool can be used to develop, debug, and deploy Web and server applications that run on Linux and other Java-enabled platforms. Novell’s and Mainsoft’s cooperation is an example of how well an open source model can work. The two companies have complementary research agendas and partner to deliver options for enterprises and ISVs to get their assets to run on multiple platforms.

Today the. NET/ECMA virtual machine (VM) is one of the most advanced VMs available, and the Mono Project helps to bring the benefits of this virtual machine to Linux. A Linux developer can leverage Visual Studio to create rich applications. Meanwhile, Mono allows the Windows developer to support more than one platform, instead of requiring a rewrite to support Linux.

Applications built with ASP.NET or Windows.Forms can be ported with little or no effort to Linux. In addition to supporting the usual. NET APIs, Mono also includes support and libraries that take advantage of Linux-specific, Unix- specific, or GNOME- specific features.

For example, a developer might benefit from sharing the C# or Visual Basic.NET internals of his application across platforms, but port the GUIs to native Linux libraries using Gtk#. In doing so, he obtains the benefits of the rich. NET VM and all of the class libraries available on Linux.

Mainsoft uses many of the Mono libraries in the distribution of its Visual MainWin for J2EE product suite. When using. NET, applications are built into a bytecode language called Microsoft Intermediate Language (MSIL), and this bytecode is compiled at runtime into native machine language using Just-In-Time compilation (JIT). Visual MainWin for J2EE cross-compiles this MSIL code into Java bytecode, with the ASP.NET, ADO.NET, XML, and Visual Basic class libraries enabling the execution of Web and server-based applications on open systems.

Using Mono, a Microsoft ISV can offer its applications to Linux with a minimal additional investment. By keeping the source code in a single managed language, the cost of porting and, more important, maintaining an application can make Linux versions economical.

Mono and Mainsoft software are useful when applications have a need or an economic advantage to run on platforms other than Linux. Novell, for example, uses Mono in a wide variety of projects, including the iFolder client and server, its photo management software (F-Spot) and media player (Banshee), and the Beagle desktop search product.

Other companies have also found success with cross-platform development models. SourceGear uses both Mono and Mainsoft software to provide Vault, the company’s source code control software on Unix systems. Otee uses Mono for its Unity Game development engine. VistaDB uses Mono to provide its VistaDB embedded SQL database engine across multiple platforms. And Segway Software uses Mainsoft’s software to deliver a tight integration between its Segway Sales Productivity Suite, written entirely in Microsoft. NET, with an enterprise customer’s existing pricing management and configuration system written in Java. There are dozens of other success stories for cross-platform porting and support using cross-platform development tools.

Where Mono Stands Today

The Mono development platform at its core implements the ECMA 334 and 335 standards. These are the Common Language Infrastructure execution engine (CLI) and the C# language, respectively.

Today, Mono is a complete implementation of the standard and it includes many of the components that developers require, such as ASP.NET (for web application development), ADO.NET for database access, and Windows.Forms for client applications.

These libraries are binary compatible with the Microsoft stack, so no recompilation is necessary. All that a user needs is a binary to deploy into the new operating system. The Mono libraries are an ASP.NET compatible Web services and Web Forms stack, an ADO.NET component for developing database aware applications, and Windows Forms for bringing Windows. NET GUI applications to any Mono supported system.

Mono includes also a set of tools for developers to create software. The project provides a C# 2.0 compiler that supports the latest language specification, including generics, anonymous methods, and iterators, as well as assemblers, linkers, and API documentation for these.

Mono would not be successful in the open source world if it did not have extensive support for the platforms that open source developers use. And Mono supports a wide variety of hardware platforms, as well as operating systems. 32-bit ports of Mono include the x86 architecture, Sun’s SPARC, the embedded ARM processor and the s390 mainframes. On 64-bit systems, Mono supports the Itanium, the s390x, and the x86-64 architecture, with ports for other platforms following closely.

Interestingly, the ECMA CLI standard is a virtual machine designed to host programming languages other than just C#. The CLI also included a number of extensions to the execution system that made it suitable to host language that were radically different. In addition to the CLI specification, an extension called the Common Language Specification (CLS) outlined how multiple languages can interact with each other. The CLI provides the engine, and the CLS provides the conventions necessary for multiple languages to work with each other.

Today, Mono allows developers to mix-and-match components written in a variety of languages. You can use the standard. NET languages (C#, VB.NET), Java (using IKVM and the GNU Classpath as the runtime), IronPython (an accelerated implementation of Python for the CLI), Boo (a fascinating language for developers that do not want to type a lot of code); PHP (with the Phalanger compiler, and Nemerle and F# for those that like functional languages, plus many more.

The most recent major release of Mono, Mono 1.2, was focused on getting all the bits for .NET 1.1 compatibility in place. But as the work in some areas was completed, some of the Mono developers moved into supporting the new features available in .NET 2.0. Today, some components of 2.0 are available on the 1.2 release of Mono, but they are not complete. This is the goal of the next release, Mono 2.0, to bring the complete 2.0 functionality to developers on Linux.

Anyone using the. NET Framework version 1.1, and perhaps looking at or starting development with 2.0 should start with or migrate to Mono 1.2. It provides the most up-to-date released components for. NET 1.1 and some for. NET 2.0, while maintaining backward compatibility to previous versions.

Comments are closed.