J-F Bilodeau's Blog @ chronogears.com

Tuesday, April 15, 2008

Hold the Mono, please

Does Microsoft innovate? I think so, but not as much as people think. They are very good at taking existing ideas, and adapting them to work only on their products.

This leads me to the .NET Framework, their competitor to the Java programming language. Java is a programming language that has been around since 1995 and has enjoyed tremendous success in the computing world. Its success is due to a number of factor. Personally, I feel that Java succeeded because it used and encouraged a number of best practices, like forced exception checking, strongly typed language and taking full advantage of object orientation as well as design patterns. Furthermore, Java evolved through the Java Community Process. The JCP is a process managed by Sun Microsystem, the creator of the Java programming language, that allowed interested parties to participate in the development of the language. This means that Java is not the brainchild of solely Sun Microsoft, but also that of IBM, Borland, Novell, and many other organizations. Because many organizations actively participated in the development of the project, this encouraged adoption.

Today, the success of Java is undeniable. There is one company, however, who is directly threatened by Java, and that is Microsoft. One of the early promise of Java was write-once-run-anywhere. That is, you write your computer code once, compile it, and then you can run it on Windows, Mac OS X, Linux, your cellular phone or whatever else you'd like! This is a reality today. I do a lot of Java development, and use a lot of Java programs on Linux, the Mac and Windows.

It works. Microsoft does not like this. They would prefer that applications are written for Windows and stay on Windows.

To achieve that end: enter the .NET Framework. Microsoft created .NET as a response to Java. To compete, they create a language that superficially resembles Java called C#, and a framework that is tooted as write-once-run-anywhere. They even went a step further and got part of the .NET framework standardize with the ECMA.

Just like Java, the success of .NET is undeniable. Let me be the first to say that Microsoft actually came out with some cool ideas. I like LINQ and I think that Workflow Foundation will be an important set of API in the future.

However, I will not develop open-source application with .NET for two reasons:

1. It is not free software. Java has recently been freed by Sun Microsystems. Yay! I hope that this will continue to speed the adoption of Java on Linux. However, .NET is not free. Microsoft owns a number of patents on .NET and has yet to provide a license to their intellectual property that is compatible with the GPL. Until Microsoft opens .NET, I will not touch it with a ten foot pole on Linux.

2. It is not write-once-run-anywhere. It's true that I can create a .NET application on Windows and run it on Linux. However, please repeat after me: .NET is not write once run anywhere. Saying that .NET works on Linux is bullcaca.

For starters, there is a project that is sponsored by Novell (and indirectly, by Microsoft) called Mono which permits the development of .NET applications on Linux. However, repeat after me: .NET is not write-once-run-anywhere. I need to get that into your head. Sure, it looks like it's portable, but here are the problems you will encounter:
  • The API to write GUI (windowed) application is meant to run on Windows. Whatever application is created on Windows with .NET will look good on Windows, but look like crap on Linux. Futhermore, Mono has its own GUI API that is incompatible with the one provided by Microsoft. This means you either create your .NET application to run on Windows or Linux. Say bye-bye to portability. Score 1 for Microsoft!
  • Microsoft is introducing more and more Windows specific API. Just the names of the APIs should give you a clue: Windows Presentation Foundation. Windows Communication Foundation. In other words, Microsoft is making sure that your write-one-run-anywhere investment is glued to the Windows platform.
  • The is no community process. This means that Microsoft has sole control over the direction of .NET. Don't go whining to Microsoft that your gorgeous .NET application looks like crap on Linux and does not work on your Mac. They don't care. Actually, that's a lie. They do care. They care that it runs on Windows and only on Windows. You can expect more and more Microsoft Windows specific API on .NET masquerading as 'open,' 'portable' APIs.
  • You are creating .exe and .dll files. Unlike .class or .jar files in Java, These files are Windows specific. They contain MS-DOS and Windows code. In a Java application, there is not a single line of platform-specific code. That means that Mono has to be able to load a Windows executable on Linux. For something that is supposibly portable, it sure carries a lot of Windows with it.
  • But Linux already has strong support for .NET with Mono! you say? So, why not use Mono? The reason is simple. It's a Microsoft technology. It belongs to Microsoft, and should they decide your Mono application is eating away at Windows market shares, prepare to receive a kind letter from Microsoft politely indicating that since you are using their intellectual property, you owe them $$$.
  • Though I doubt that Microsoft will ever collect open source developer for the use of their so-called intellectual property, I think that the real problem will be that Mono on Linux will forever play catch-up with .NET on Windows. Who wants to use a 'write-one-run-anywhere' technology that is one or two years behind on some important platforms? Either you write a Windows-only application in .NET, or look at alternatives.

.NET exists solely to further Microsoft's agenda. Anyone that chooses to use Mono on Linux is kindly helping Microsoft achieve that agenda. Yes, there are some cool ideas in the .NET framework, but most of those ideas are copied from existing languages. For example, I've been using workflow management API and designers long before Microsoft came out with the Workflow Foundation API.

Before you consider Mono, please take a look at what's available on Linux already. You want true write-once-run-anywhere? Java is one solution. Not good enough? What about Python? Pascal? PHP, C/C++? Need I go on?

Linux is where it is today not because of heavy-handed sales tactics or razzle-dazzle marketing, but by its own merit. Let's continue to develop Linux through it's own merit.

We will not innovate if we follow the Microsoft path — that is, mostly copying what others are doing.

As for me, I think my plate is delicious as it is. I'll hold on that Mono sauce, thank you very much!

Labels: , , , , , , , , , ,

Sunday, April 13, 2008

Enjoying the Asus Eee PC

Having just received my Eee PC, I'm still getting familliar with it's capabilities. The keyboard requires getting used to, but I'm getting better. As long as I don't have to use the right shift key too much, I can almost achieve the same typing speed as on a regular keyboard ;) All joking aside, once you get used to the keyboard, it's actually quite pleasant.

I got the 8G model, which means that I have a whooping 8 gigabytes of 'hard disk' space. While this is tiny compared to a regular hard-disk, which is usually over 100 gigabytes for a laptop. However, for my needs, I think that 8G, or even 4G should be enough. Since the Eee PC supports SD cards, I'm using a 4 gigabyte card for my /home partition (for Windows users, think My Documents).

The pre-installed operating system is a custom version of Xandros Linux (which is based in Ottawa). Though the default is fine for most people's need, I wanted something that gave me more -- so I installed eeeXubuntu. I removed the default Gnome games, Abiword and
Gnumeric to save space, and them promptly installed:

I've got ~640M of space left (which ought to be enough for anybody) on my system partition. Not too bad, considering I've got a practically complete portable development system.

One of my goals is to get Morrowind working with Cedega. So far, no joy, but I'm not about to give up. I know some folks got it working, so I'm sure I can as well.

If you are going to install eeeXubuntu or Ubuntu, be aware of the Eee Wiki. One of the coolest trick I found is how to enable the ALT+F11 key to make a window take the full screen. That really takes advantage of the 800x640 screen resolution. There are many more cool tricks on the page. Check it out!

Software for Windows seems to take up much more room than software for Linux. If anyone plans to run Windows on the Eee PC, I would like to recommend they consider using Google Docs. It is a word processor, spreadsheet and presentation package that runs in a web browser like Internet Explorer or Firefox. Using Google Docs does not require you to install and special software. As long as you are connected to the Internet, you can use it. Futhermore, Google Gears should eventually allow you to run online application offline.

Actually, I'm using Google Docs one my Eee PC right now to author this article. So far, the Eee PC turns out to be a fun, yet useful machine. My wife is starting to strongly hint that I'm spending too much time on it. Oups! I think I should wrap up this article, and spend some quality time with her! See ya!

(Hum... I'm a bit disappointed with the Google Docs' HTML exporter. I wish it did XHTML)

Labels: , , , , , , , , , , ,

Wednesday, March 19, 2008

Why I (Still) Love the Pascal Programming Language

Day-to-day, I use Java, C++, Python and a host of other programming languages. I like my modern programming languages. However, my first programming language love refuses to die -- Pascal.

Pascal is not a perfect language. For that matter, there are no perfect language. However, some languages can arguably be said to be better than others. This said, I will readily accept that Pascal has important flaws, which I will discuss later. However, here are the reason why I like Pascal, and why I think you should give it a spin:

Available on Most Platform
The Free Pascal and GNU Pascal compiler is available for most platforms, including most *NIX, Macs and Windows. Heck, you can even write code for the GameBoy DS! Furthermore, the code is usually portable with minimal or no changes.
The Free Pascal motto is 'Write Once, Compile Anywhere.'

Compiled
It's not interpreted. It doesn't use bytecode or IL. It's compiled straight to machine code. Thus, your Pascal applications can run as fast as any C application.

Lightning Fast Compiler
That's one cool thing about (most) Pascal compilers I've used. It's blazingly fast. This greatly reduces the write-compile-debug cycle.

Still Active
Though far from being as popular as C or Java, there is still strong support for the language. I don't think we can consider it a 'dead' language yet.

Structured
I think many people may disagree with me, but I like Pascal's strict structure. It forces me to think my code through a bit before I hack away. Also, once the code is written, I find it's usually very readable. Nicely written Pascal code can be close to English.

Native Data Structure
Arrays and numbers with any lower and upper bounds, sets and enumeration native to the language make Pascal a lot of fun to play with. You don't even has a set data structure in .NET 2.0!

Pascal also has a fairly complete collection of basic data types, and they're all first-class citizens. In other words, they are not classes that implement the functionality. Thus, they can be optimized by the compiler.

Multiple Paradigm
Pascal supports procedural programming and object-oriented programming, and the two can coexists peacefully.

LCL
Though not a standard part of Pascal, the LCL (Lazarus Component Library) is strongly supported by the Free Pascal community. It's a wonderful way of building GUI application and is available of all major platforms (Linux (GTK2, QT), Mac OS X & Windows)

As I mentionned above, Pascal is not perfect. The language was created in 1970 and was originally designed to encourage structured programming (no gotos).

Here are some of the things I would like to see improved in modern Pascal:

Precedence of Operators
Pascal has only four level of precedence of operators, which makes writing some conditional statements (and, or, etc) ackward. Brackets can be used, but they can also make the code more difficult to read.

Garbage Collection
The memory management is Pascal is up to the programmer. Being a C++ developer, I like manual memory management is some context. However, being also a Java developer, I would like to take advantage of automatic garbage collection. It would be nice if I could choose the memory management strategy for my application.

Templates / Generics
C++, Java and .NET supports Generics. They can same a lot of dynamic casting while making your application type-safe. By eliminating dynamic typecast, the execution speed can be improved.

I would love to have a generic TList or TMap.

True Platform Independent VCL
The VCL (Visual Component Library) was born out of Delphi -- a beautiful competitor to Visual Basic that never enjoyed the success it deserved. The VCL was created on Windows for Windows and during a very short time, ported to Linux.

The Lazarus project recreated (and expanded) most of the VCL called the LCL (Lazarus Component Library, but aimed to retain compatibility with the VCL. This is great if one is developing on Windows, but makes it ackward on other platform like Gtk2 (Gnome), QT (KDE) or Carbon (Mac OS X). This is due to the fact that the (V|L)CL refers to Windows API and constants by name. A layer of abstraction between the LCL and the underlying system would make the code look native on any platform.

Furthermore, having dynamic layouts like Java that adapt themselves automatically to the platform would be almost essential.

Object Oriented Version of String, Array, Set, Enumeration, etc...
Using strings or array remains procedural. I would love to have a compatible but object-oriented version of the build-in data types (I know that seems to contradict one of my points above, but they could remains 'compiler' classes). A simple solution would be to make a string class, and recreate the string functions to call the method on the string class, thus preserving backwards compatibility.

Pascal has survived nearly 40 years mostly unchanged. There has been refinements, additions and extensions added to the language. However, a Pascal program written 30 years ago may still compile in a modern Pascal compiler.

Though nowhere near as popular as C/C++, Java or .Net, I think that Pascal has a lot to offer. If you've never used Pascal before, consider downloading Lazarus to help you get started. There are plenty of great Pascal tutorial available on the web.

Happy coding!

Labels: , , ,