The Book

Cross-Platform .NET Development: Using Mono, Portable.NET, and Microsoft .NET (ISBN: 1-59059-330-8), was written by M.J. Easton and Jason King and was published in September 2004 by APress.

The book is for anyone who dreams about the grail of platform independence or for anyone who longs to use one of the most advanced development platforms on his or her OS of choice. It is primarily aimed at developers and software architects who are familiar with building Windows solutions using .NET and are interested in creating solutions for non-Windows platforms; as a corollary, it's also aimed at those who prefer non-Windows platforms and have an interest in building .NET solutions

While it's most definitely a technical book for computer professionals (and any so-inclined freakish amateurs), it's also the biggest software story since the last biggest story: the coming of age of Microsoft's premier cross-platform development tool, .NET.



Contents


Chapter 1: Introducing .NET

This chapter introduces .NET as a development platform that is suitable for cross-platform development, examining how the standardization of the Common Language Infrastructure (CLI) architecture lends itself to implementation on different operating systems, and how the underlying technical concepts of .NET provide a highly portable, advanced runtime environment. It also describes the various CLI implementations that are currently available and the platforms that they currently run on.

Chapter 2: A First Cross-Platform Program

Chapter 2 describes how to download and install working CLI implementations onto Windows Server 2003, GNU/Linux, and Mac OS X. The chapter then discusses the subsidiary issues of how to prepare a cross-platform laboratory and ensures that the reader has enough knowledge of the three platforms to run through the book. A simple C# program is then introduced, compiled, and run on the three platforms to demonstrate the basic cross-platform features of .NET.

Chapter 3: Cross-Platform Pitfalls

This chapter starts by discussing CLI binary portability and Intermediate Language (IL), before disassembling a program to compare the IL that is generated by different CLI implementations. It then investigates how to deal with platform-specific assemblies by analyzing how Portable.NET mimics the registry, before suggesting some alternative ways of avoiding the registry. The chapter finishes by defining some terminology to use when developing cross-platform .NET software.

Chapter 4: The .NET Framework Dissected

Chapter 4 documents which Microsoft .NET Framework features are intrinsically cross-platform and which are based on Windows-specific features. After describing the functionality that is available in the CLI-defined libraries, the chapter differentiates between architecturally independent and architecturally dependent namespaces to allow the reader to determine which .NET features are most suitable for his or her cross-platform projects. The second half of the chapter introduces the bridge design pattern and demonstrates how it can be used as part of a strategy for developing robust, cross-platform software.

Chapter 5: The Spice of Life: GUI Toolkits

Delves into the vast array of options for creating cross-platform GUI applications. It starts with a description of an ideal managed GUI, before contrasting how the different CLI implementations handle the System.Windows.Forms namespace. The chapter then describes a number of other GUI toolkits that are usable with .NET, including Gtk#, QT#, #WT, Ticklesharp, and wxWidgets. The final section of the chapter shows how the classic Model-View-Controller pattern can be used to develop applications in a toolkit-agnostic fashion.

Chapter 6: Developing Distributed Applications

Chapter 6 describes the issues revolving around distributed cross-platform applications. It starts by describing how to use ADO.NET for database access and demonstrates a cross-platform database application using the open source MySQL database server. The chapter then introduces ASP.NET, describing how to install ASP.NET on various platforms, and then contains an example Web application that is followed by an example Web service.

Chapter 7: Using Native Code

Discusses how native code should be approached when developing cross-platform software. It starts by investigating how the different CLI implementations rely on native code before introducing the NativeProbe tool, which can be used to analyze assemblies' native dependencies. The chapter then demonstrates how P/Invoke can be used to call native functions, discusses how conditional compilation can be used to call different C functions on different platforms, and shows how an abstract factory pattern can be used to good effect. The chapter finishes with an example of a cross-platform program that plays sound using an OpenAL native library and the Tao.OpenAL assembly.

Chapter 8: Remoting, Components, and Interoperability

Chapter 8 shows how .NET can be used to interoperate with existing software and how to port existing code to .NET. It starts by discussing the Common Language System and then shows an example of how to bridge Java to .NET using IKVM. The chapter then demonstrates how VB6 code can be ported to .NET, before discussing Remoting with a simple cross-platform example. It finishes by showing how .NET can be integrated with component technologies; this is backed up with an example of CORBA integration using the Remoting.Corba assembly.

Chapter 9: Testing and Building Strategies

This chapter describes some best practices for developing robust, professional software. It starts by demonstrating how unit testing and the open source NUnit tool can be used to promote quality software. The chapter then demonstrates techniques for building cross-platform software using NAnt.

Chapter 10: Summary

Chapter 10 concludes the book by discussing the future of .NET as a cross-platform technology, finishing with a little food for thought.

Appendix A: The Unified Modeling Language

Because the Unified Modeling Language (UML) is the de facto diagramming tool for modeling object-oriented software, it is used almost exclusively throughout the book. For readers who are not familiar with UML, Appendix A contains a précis of the key concepts and various diagram types that are defined within the UML.

Appendix B: .NET Framework Map

To allow you to quickly determine which .NET features and namespaces are cross-platform, platform-independent or platform-dependent, a complete map of Microsoft's .NET Framework Class Library is presented, as first described in Chapter 4.

Appendix C: Additional Portable.NET Features

This appendix provides a list of the additional assemblies and tools that are available with Portable.NET.

Appendix D: Additional Mono Features

Lists the various assemblies and tools that are unique to Mono appear in appendix D.