This is a read-only archive!

C#... kind of doesn't suck?

At work recently (as in, yesterday) I was faced with the problem of re-writing a scientific app written in the mid-nineties. This thing was a full-screen DOS sort of app and today what with laptops and their widescreen huge-resolution displays, the program wasn't readable for the average human being. All it does is display text in different colors and take keyboard input.

So I got to pick a language to re-write this app from scratch. My first thought process was "Ruby!", but this app is a multi-threaded, GUI app running on Windows laptops that don't have Ruby installed, which is about the worst possible kind of program to try to write in Ruby, aside from maybe device drivers.

So I considered Java. A brief search reveals that even in present-day Java, you still apparently don't have the ability to easily compile Java programs to a native Windows exe. There are some Java compilers but they seem like hacks and many of them are non-free (as in money). Then I remembered that I've never seen an easy-to-use wysiwyg tool for building Java GUI apps. A google search turned up nothing, and the last version of Eclipse I used didn't let me do it either.

So then I decided oh well, I may as well bite the bullet and try C#. I've never used it before. There's a free version of Visual Studio called Visual Studio Express that you can download. (Note: I remember always wanting such a thing about 10 years ago in high school when I was just learning programming for the first time. Maybe if such a thing had been available for free back then, I would have been indoctrinated into the church of Microcrap early on rather than wandering in Linux. Their loss.)

I don't know what's missing in the free version of Visual Studio compared to the thousand dollar shyster version. The free version has a draggety-drop GUI builder, and it has the standard IDE with the auto-completion etc. It's no Vim, but it's better than anything I've ever tried to use to write Java, certainly. It's also better than writing Java in Vim, because writing Java in anything is pure unadulterated pain.

So far as the language itself, C# is noticeably more pleasant to deal with than Java, while at the same time being a blatant ripoff of it in almost every way. But some of the stupid Java annoyances are gone. For example C# doesn't make you catch every single exception that every single bit of code ever throws, which is a blessing. And it doesn't seem to try to force you to keep your files in certain kinds of directory trees. On the other hand, there are of course incredibly stupid limitations to C# for no reason I can tell. e.g. it doesn't support default parameters and doesn't allow constant arrays.

In any case, having never even seen a line of C# as of yesterday, I was able to almost finish my app in about 2 days with relatively little pain. And it's a native Windows app that can easily be deployed. If I ever find myself forced to write a Windows GUI app again (God help me) I'll probably start off with some form of .NET. If good GUI-builder tools or native-exe-producing compilers exist for Java, they need to be better advertised or something.

So given that it's Windows programming, i.e. automatically worse than almost everything else in existence, C# isn't bad, relatively speaking. I'd still rather be writing Ruby.

October 26, 2007 @ 11:50 AM PDT
Cateogory: Programming


Quoth Hussam on October 26, 2007 @ 12:59 PM PDT

Java has NetBeans. Very well polished and allows great flexibility and speed in writing GUI apps in Java. The catch, it's written in Java so you should 'at least' have a modern day computer with enough memory to not cause slow downs.

If you're programming for windows, always default to using .NET. It'll be your best bet. Programming with the mindset that it's not VIM or doesn't have X functionality of Ruby/Perl doesn't really help. I've tried that already.

Kevin Mark
Quoth Kevin Mark on October 26, 2007 @ 1:54 PM PDT

as a gentoo user and now a c# users, will you try porting it to mono? if not, why?

Quoth Brian on October 26, 2007 @ 3:57 PM PDT

I will if someone pays me.

Quoth numerodix on October 27, 2007 @ 1:18 AM PDT

"And it's a native Windows app that can easily be deployed."

So it's not a .NET application then? Interesting, I thought c# only had the .NET compiler and every c# app would be .NET as well?

Quoth Brian on October 27, 2007 @ 4:35 AM PDT

I think everyone has the .NET framework because MS forces you to download it via Windows Update. I may be wrong so I'll see if there are problems when I deploy it.

Steven Oliver
Quoth Steven Oliver on October 29, 2007 @ 2:53 AM PDT

I'm quickly finding that C# is becoming the new cool language to write your programs in... at least in Windows anyway. I think Ruby holds the that distinction in the Linux world.

Personally I haven't used it yet, but I guess I'll find out soon enough.