Monday, November 8, 2010

Why .NET?

The question is "Why .NET". Well it really starts with why a Virtual Machine (VM) runtime. The answer for me was :

When you think of your software running unattended for large periods of time and factor in the time you have to develop said software ... VMs help. 

Goodbye C++ / C. Hello .NET / JAVA. 
Now, "Why .NET". Really once you have settled on VM the only options you have for mass consumer targeting are .NET and JAVA. Really. 

So why .NET is actually a question of "Why not JAVA?" or "What makes .NET Better than JAVA?" 
Before I continue. Note that a major part of my final year project for BE Telecom was made in JAVA. (A SIP Proxy server). So there was a time that I "Loved" JAVA. 

JAVA as a language:
Java still doesn't have true getters / setters. You need to type GetName SetName yourself. If its a standard push it to the compiler please. 
The reason is that language features need to go through JCPs and it can still take years before it makes it to mass distribution. A non evolving language is either a dead language or a dying language albeit really really slowly (A note on JCP's lack of progress : http://blogs.apache.org/foundation/date/20101209 ). 

So here are the features I love in C# as it Evolves:
Properties
Linq
Dynamic Types
Yield (oh it is so hot!)
Async Programming
WPF ... okay its a library ... But an AWESOME one at that. Swing just does not come ANYWHERE close anymore

These will take a long time to make it into JAVA (if ever). JAVA is more focused on APIs rather than the Language itself. And the Desktop APIs still suck. More on that later. 

Now for the annoyances that already made it to the language. 

Exception me please:
You cannot add a new exception throw all of a sudden without the compiler complaining. All for the supposed claim that it will prevent unwanted exceptions. And the fun part. It can be bypassed. Virtualize or late bind much? I do. 
PS: Mostly people are just forced to catch and ignore exceptions. The compiler actually breeds BAD code. 

Return:
Okay I am being sloppy here. But while testing I like to return prematurely from a function sometime. Or maybe I write half the code. Then to test something else I put up a mock return. In JAVA I need to Comment out the remainder of the function just to compile. I prefer the C# version of the warning me but not getting in my way. Just run the code. 

Swing:
For those that don't know Swing is the THE premier JAVA GUI framework for the Desktop. What got me was Windows Vista going into the Windows classic look and feel stating "A running program isn't compatible with certain visual elements of windows". I would hate to explain this to my clients. http://www.hanselman.com/blog/SunsJavaJRESwitchesVistaAeroIntoBasicUIScheme.aspx

Jeff Atwood pretty much explained everything wrong with this in 2007. Its funny how a bad Desktop UI will almost always have a mention of JAVA.
 Oh did I mention desktop applications are what made me fall in love with programming and before Flex (yes it came first)/Silverlight desktop apps are the only place I would be found. Other than "really" trivial PHP scripts :).  PS: JavaFX has terrible penetration for a reason :) 

I like applications full of power. Desktop is the way. AUTOCAD / MAYA / MAPINFO / MATLAB / MS Office / TEMS  all great applications that are primarily on the Desktop for a reason. And if you are going to go to a runtime. You know which one to choose :). Plus I do Telecom Software. We love the Desktop. Its our home :)

Java and Lawsuits. So much for "Open": 
To be fair. Java defends "http://en.wikipedia.org/wiki/Write_once,_run_anywhere" very strongly. But their J2ME is no treat either. 

Microsoft:
Well for quite a while (a long long time ago) Microsoft's implementation of JAVA was awesome with great Developer productivity. Till Microsoft got sued for it: http://en.wikipedia.org/wiki/Microsoft_Java_Virtual_Machine
So Microsoft came up with .NET. Maybe Redmond already had such plans but I don't know. 
Microsoft responded for being sued by Sun: http://www.internetnews.com/ent-news/article.php/988071/Sun-Sues-Microsoft-Over-Java.htm Java still doesn't come preinstalled in windows. Your hardware vendor might do so. 

Google:
Yes. For android. Oracle sues Google for Java derived runtime: http://news.cnet.com/8301-30684_3-20013546-265.html . Google does not attend JavaOne : http://googlecode.blogspot.com/2010/08/update-on-javaone.html

Oracle is a financial institution
Oracle defends its profits VERY diligently. 
They did make MySQL InnoDB commercial as well : http://www.cloudave.com/7356/internal-email-on-why-a-software-company-migrates-away-from-mysql/ (Note the CEO also warns against JAVA). But I saw that (thanks to other intelligent folk on the internet) coming from a mile http://basaratali.blogspot.com/2010/05/free-for-commercial-use-high.html . Postgresql is the future MySQL. 

Finally Some JAVA love:
Java is not all that bad. I wouldn't be caught dead writing a JAVA app for the desktop....never again. But for the server of the top of my head GWT is cool. Well at least the results are ... I haven't tried it myself. Pentaho is very cool. JasperReports are amazing. These are not "JAVA" goodness per say but hey a runtime is valued by what it runs. So I guess its third party love :) But for my raw code I still doubt I would ever go there. 

Fun Java Quotes by People I Respect: 
If you feel these are taken utterly out of context. Well Quotes usually are so I link to the complete context :)
Everything on this page is my opinion. I am in no way legally liable for anyone else's actions.
The last update time for this page should help, since technology changes and JAVA might get these features :)