Java coder in a C# world

As an initial blog, I thought I would start out by writing about the stuff I’ve been doing over the past few months. Having been a Java coder for a number of years, I have recently been introduced to the C# .NET world – mainly because of the requirements of a project.

This has highlighted a few issues for me. Java being a wonderful language lacks some of the cool features that are provided when working with C#. I won’t go into any details, however, to  name but a few of the features i’ve come across are: Lambda expressions(=>), LINQ Queries, and the Reactive Extension framework (Rx). Lambda Expressions http://msdn.microsoft.com/en-us/library/bb397687.aspx, are anonymous functions that have an expression and a statment, and can provide for some very concise code especially when working with the Rx framework subscriptions. Also, working with a load of C# guys, they were wondering how Java developers can get away without having a query language like LINQ http://msdn.microsoft.com/en-us/netframework/aa904594.aspx, which can be used to provided SQL like queries on collections for example. Reactive Extensions (Rx) are great for writing event based programs http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx, these provide for very fast non-locking event based development.

Another useful tip is to watch the Microsoft Channel9 videos (just search the internet for Microsoft Channel9). There are a number of great talks on a number of MS creations.

On the whole, working with C# is surprisingly intuitive (or not so, considering where it was derived from ) for a Java guy. But Microsoft seem to have the time and money to invest in Research which maybe Sun lacked. I’ve heard that Java 7 will have some cool features, but it seems that Java is playing catch-up at times in terms of it’s language maturity.

On another note, I’ve been looking at Scala http://www.scala-lang.org/. This is a great language which is more mature than Java, and gives you the benefits of functional programming with the ability to talk to standard Java code as well  . Scala runs on the JVM and compiles to byte code and has some very powerful language features which I will leave you to read about.

Leave a comment