Why there's no need to abandon .NET for open source

In this article, we explore some options for developers to fuse .NET with open source development.

A client recently greeted me with a barrage of complaints about Microsoft, product costs, and so forth. They wondered aloud whether they ought to assemble a strategy for moving to an open source platform to save money. Now, I'm not one to start an argument about the merits of consumer vs. open source. Rather, I took the opportunity to point out the open source route available to .NET connoisseurs.

The application mix
For the sake of this article, I'll concentrate on client/server applications. These applications usually consist of the following parts:

  • Database server: SQL Server is a popular choice for .NET-based applications, but connectors for other systems like Oracle and DB/2 are available.

  • Application server: The server that hosts the application that is utilized by the clients. IIS (Internet Information Services) is the typical choice with an ASP.NET application. In addition, the .NET Framework is necessary.

  • Client: The interface used to communicate with the application server. This is a browser for ASP.NET applications.

For the most part, the client portion is beyond the developer's control (the exception is an intranet application). On the other hand, there are options available for the database and application servers with the backend database being the most obvious.

Using an open source database
Utilizing an open source database backend with a .NET application is a snap with two freely available database engines:

  • MySQL: MySQL has become the most popular open source database and the fastest growing database in the industry. It offers cross-platform support combined with ease of use. In addition, commercial licenses are available for those organizations worried about support.
  • PostgreSQL: An enhancement of the POSTGRES database management system (and is still sometimes referred to as simply "Postgres"), a next-generation DBMS research prototype. While PostgreSQL retains the powerful data model and rich data types of POSTGRES, it replaces the PostQuel query language with an extended subset of SQL. PostgreSQL is free and the complete source is available.

Installing one of these open source database systems on a Linux server introduces huge cost savings, but individuals familiar with these systems (along with Linux) will be necessary to keep everything running smoothly.

Connecting the database to .NET

With the database platform selected, it must be properly connected with the .NET application. You can utilize the generic ODBC connector or a connector designed for the database system.

The PostgreSQL system doesn't offer a native connector, so you must use the vanilla ODBC connector. By default, it's included with the .NET Framework so this isn't a problem. The mySQL database system offers its own connector. This allows you to natively connect to mySQL. Programming these connections does require the .NET Framework or possibly an open source alternative like Mono.

The Mono Web site (http://www.mono-project.com/about/index.html) describes Mono as "a comprehensive open source development platform based on the .NET Framework that allows developers to build Linux and cross-platform applications with unprecedented productivity." I'll let you discover whether the productivity claim is true, but it does bring .NET development to non-Windows systems (Windows is supported as well). The product supports only C# (the ECMA standard), as well as the Common Language Infrastructure (CLI).

Development environment
With a development platform installed, you may choose to develop applications with the command line and a text editor. Another choice is a freely available development tool like #develop. It allows you to develop applications using a graphical interface similar to Visual Studio .NET.

The snag with using #develop is the fact that it requires the Microsoft .NET SDK, so this creates problems if Mono is being utilized.

In addition to visual development, there are other freely available tools like the following:

  • NUnit: Open source unit testing framework for .NET
  • NAnt: Platform for creating the build process
  • NDoc: Open source tool for building API documentation

Numerous options
Many people immediately think of high prices and lack of options when they think of .NET development. The combination of Microsoft's submission of C# as a standard and its embracement by the open source community has opened numerous non-Windows options.