J-F Bilodeau's Blog @ chronogears.com

Friday, December 19, 2008

Java (does|doesn't) suck

I use Java programs all the time: jEdit, Eclipse and ArgoUML just to name a few. As a programmer, Java has served me well for over a decade, and I've never once wrote a piece of Java code of which the performance was unacceptable.

However, I keep hearing other user complain and snicker about the performance of Java. Though I try to defend the performance of one of my favourite programming language, I continue to hear the same chant again and again.

Once and for all, let me say: Java is not slow. If you don't believe me, come to my Java Performance Tuning course. I'll be happy to write equivalent Java and C code and time the execution of both.

An article on Phoronix.com brought to light something that I never expected. It would seem that Java on Windows Vista actually runs slower that Java on Ubuntu. I have to admit that this was a great surprise for me! I always assumed that Windows being the larger market for Java it would be optimize for the platform. However, that doesn't seem to be the case.

Maybe that's why there are still a lot of folks out there who are disillusioned by the performance of Java.

From prior experience, I suspect that Java application take up much less memory on Linux than Windows, but I haven't investigate that yet.

Labels: , , , ,

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: , , , , , , , , , ,

Wednesday, April 2, 2008

A Linux Dude Installs a SharePoint Server

Today, I had the dubious pleasure of having to install SharePoint 2007 on Windows Server 2003. Yay!

I'm a Linux user. I enjoy working with Ubuntu amongst other distros. I can setup LAMPs (Linux, Apache, MySQL & PHP|Perl|Python) with my eyes closed. I mean, I spend more time waiting for my package manager to download the packages than I actually spend configuring stuff. All the tools I need are immediately available at my fingertip.

A colleague of mine who is well versed in the Windows world kindly setup Windows Server 2003 on a laptop. He even installed drivers (they don't come with the OS?) and service pack 2. Now, it's my turn!

So, how does one install a package on Windows?

I easily found the 'Add or Remove Program', but quickly learned that it was more along the lines of 'Remove Programs'. I mean, I could only find the option to remove existing packages. There was no option to search for packages to install or how to configure your application repositories.

That's when I remembered that most Microsoft programs come on CDs. I found a CD for SharePoint 2007 in the office. This may not be so hard after all.

Now, with the laptop in one hand and the SharePoint 2007 CD in the other, I'm ready to rock! I slap in the CD, and wait for an install program to pop-up.

Instead, Internet Explorer 6 pops up with a security security warning. Click OK, and I'm brought to a little webpage that contains a confusing collection of links. After I find the link to the SharePoint installation program, it opens Windows Explorer, exposing a file called setup.cmd.

That looks kosher, so I double click on it. Oups! Looks like I need the .NET Framework 3.0, SQL Server 2005 as well as IIS 6.

So, how does one go about installing SQL Server 2005, .NET 3.0 and IIS 6? Why can it not take care of it's dependencies like my package manager on Ubuntu? This seems like a lot of trouble just to install a web application. One of the things that makes Windows so difficult to use it the lack of a solid package manager. Microsoft really needs to work on that before I can take Windows seriously. I feel like I'm back in the stone age where I have to manually download and compile stuff. I can already tell that installing SharePoint 2007 is not going to be a walk in the park.

I didn't chance Add or Remove Program again. I went straight for the CD. Going trough the setup was reasonably painless. However, I'm surprised as the number of steps (screen, windows, whatever) one has to go through just to install a database server. Why can't Windows keep things simple?

Now, onto the .NET framework 3.0. Before I started to look for yet again another CD, I though to myself mdash; there has to be an easier way! Thankfully, I've had enough experience with Windows to know about Windows Update. It took me a moment to find it in the Start menu. There were nearly two dozen updates. This is not concerning to me, since in Ubuntu, I may get dozens of updates for all my installed application (and I have a lot!). However, I'm concerned that the vast majority of my update are security related — and these are only for the OS.

Interesting, Internet Explorer 7 is a recommended update, but .NET 3.0 is an optional update. Nevertheless, I select all recommended updates as well as .NET 3.0. Click the button, and KABOOM! All the updates fail to install. The carefully worded error message recommends that I try again, otherwise, look up troubleshooting in the help.

I try again...and again...and again to no avail. Even a single update fails. So, I click on the convenient URL that links to the help. As convenient as the link seemed, the help was not.

Being in foreign territory, I turn to my Windows guru. After reproducing my steps a couple of time, He recommends a reboot.

Miraculously, rebooting worked! The updates downloaded and installed without problem mdash; except that I had to reboot twice more. I guess they were mostly kernel updates. How often do you have to reboot Windows? I have some server that have been live for over a year without reboot. I wonder if I could do the same with Windows...

I've also noticed that Internet Explorer required a couple of clicks to installs, and performed some work at boot-up. I wonder what kind of browser needs to spend about a minute setting itself up after a reboot?

Alright, so after a few reboots, I now have the .NET framework 3.0 installed. Now, to IIS 6.

This one took a bit of searching around. I found it where I kinda expect to find it but could not see it at first. There a 'button' on the left side that says 'Add Windows Component.' The button brought me to a dialog that I remember from the days when I first installed Windows 95. Digging in there, I found IIS 6.0. Thankfully, I love Java. When I saw Application Server as a category, I immediately clicked on it to see if JBoss or Glassfish was included. My first surprise is that there were not. My second is that IIS is considered an application server. I would have though it's a web server. But who am I to argue with Microsoft?

I select IIS 6.0 (including ASP.NET, which is not included by default), and clicked install. Windows prompted me for the original CD. I could not find a way to change the software repository to use the web instead of the CD. That's kind of annoying. Does that mean I have to carry my Windows CD everywhere I go? I mean, thats three CDs I'm going through.

The installation actually went smoothly. No annoying popups or anything like that. Just like Ubuntu, it installed and configured the server for me. Yay! So now I can install SharePoint!

I double clicked on setup.cmd again. This time, SharePoint complained about having to enable something in IIS 6.0. The popup kindly explained what I needed to do. So, I followed the instruction, which brought me to some kind of wizard. As luck would have it, after the third step, the wizard asked me if I wanted to remove some stuff. I said no, and retraced my steps to make sure I had done everything correctly. The same thing happened second time through. I do wish that Windows was less cryptic so that I could understand what I'm going through. There's a lot of popup windows over popup windows, and the interface is a bit inconsistent. I took a deep breath and continued forward.

Once again, I was prompted for the original Windows CD. After I slap it in, Windows starts installing this 'Active Directory.' It must have been a large package, because it took a long time. Furthermore, it asked me to reboot again! I can setup (even compile) an entire LAMP server with a fully functional GUI from the ground up and never have to reboot. What is it with Windows and rebooting every time you change something?

At this point, my coworker are wishing me good evening. Well, I've had enough of this Windows fad for the day, so I go home, and start blogging. While I'm blogging, I'm going to do something fun. Hardy Heron is out in beta, so I might as well upgrade!

I launch my good-ol' package manager, and click Upgrade to Hardy Heron. The upgrade warns me that it may take a long time to download all the necessary packages, but at least I can continue working while I upgrade my OS. I wonder if upgrading to the new Windows Server 2008 is going to be as easy?

It's always fun trying new operating system. Though Windows seems solid, it still has a number of frustrating quirks. Installing applications should be easier, and the consistency of the interface could be greatly improved. I'm concerned about the need to reboot so often &mdash especially when adding a desktop application like Internet Explorer. There is absolutely no excuse to force a reboot after the installation of a desktop component on a server machine.

I wish Microsoft would borrow a thing or two from Linux and make Windows truly easy to setup and use.

Labels: , , , , ,

Saturday, March 22, 2008

Free Software 201

If you haven't read my previous entry, Free Software 101, I would recommend you do so before moving onto this one.

In this article, I would like to continue the discussion on the definition of free software. Previously, we explored the four freedoms attached to free software. For a software to be called free, it needs to meet those criteria.

Some software are given away, like the giftware license of the Allegro game library. Others are said to be public domain, in the sense that they do not have a copyright, and thus, have no limitations in terms of use.

Software that falls under the 'giftware' license or public domain may have the four freedoms. Any individual or organization can use the source code for any purpose, including proprietary and commercial software. Their use and the changes that they bring to the code does not have to be given back to the community. Thus, the new implementation of the software and its users looses the four freedoms.

To protect those four freedoms, the Free Software Foundation, founded and headed by Richard Stallman, created the GNU GPL (General Public License). The goal of the GPL is to ensure that any softwares licensed so would not lose their four freedoms.

This is the license that is used in countless open-source softwares like the Linux kernel, the MySQL Database and the Java programming language. Even Wikipedia uses the GPL to protect the content of their articles. A quick search on SourceForge found over 79,000 projects that uses the GPL.

The GPL is written so that anyone can use it -- both the developer of the original code, and the end user of the code. Agreeing to the GPL pretty much binds you to the four freedoms. That is, you can use the code, view the code, copy the code and share your changes, but you cannot remove those four freedoms from your work.

The GPL allows you to sell a product that includes GPL code as long as you do not remove those four freedoms in any way.

There is more to the GPL than what I've discussed here. For instance, the GPL protects the copyright holder by offering no warranty and the GPL version 3 addresses software patents. However, what I believe is important here is the spirit of the license. If you are considering using GPL code in a commercial project, you may want to consult a lawyer or contact the Free Software Foundation to clarify your right (I'm a coder Jim, not a lawyer). However, keep in mind that there are thousands of successful commercial products out there that uses GPL code. The Asus Eee PC readily comes to mind.

The GPL is one of many licenses that are designed to preserve the four freedoms. Such licenses are known as copyleft licenses. The symbol for copyleft is a reverse copyright (©) but has no legal meaning. Copyleft licenses are also known as viral licenses, since your use and derivative of the work is bound by the same terms as the original license, like a computer virus that infects every executable it touches. The analogy may be less than savory and also misleading. Installing a GPL software like OpenOffice on a machine does not spread the GPL to all your programs. However, using OpenOffice's code in a development project does bind you with the GPL. Whatever use and modification you bring to that code must retain the four freedoms. That is, you could not commercialize a new office suite based on the OpenOffice source code without releasing the source.

Does that mean you could not create a commercial software product based on GPL code? There are many commercial products that include GPL code. As a matter of fact, many commercial applications were later released under the GPL.

Examples include the Linux kernel, which is used in a number of software packages, such as paid-for distributions like Mandriva Linux. Another example is TransGaming Cedega, a program that runs most Windows games on the Linux platform.

There are many advantages to open sourcing software under the GPL, or another open source license. However, I will leave this discussion to another post.

Labels: , , , , , , ,