• Could not connect to Twitter

NTodo is published!

My Symbian app finally passed the QA process and is published in the OVI store http://store.ovi.com/content/113918

Wow–2 years

If you came across this blog, you will probably notice that it’s been almost 2 years since my last update. I was planning to keep this blog updated with interesting findings in my daily job, but my two kids and my current job at Apption Software have been consuming 17 hrs a day. Lately I’ve been able to get more time once the two little ones are in bed. I recently finished an application for Nokia Symbian smartphones called NTodo which is an advanced task manager that syncs with Toodledo.com. You can find more in my mobile apps section.

Java and C# – legacy and modern languages

I have been working for years and years with Java (I even remember the Java 1.1 years with Sparc workstations) and my only C# experience was few hours with Visual Studio Express edition trying to write a home server plugin (which I never finished). However these last 2 months I’ve been using C# and F# plus the whole visual studio suite.

I read many times that Java has something to learn from C# – and it’s so true.

1. The languages

The Java language itself hasn’t changed too much since its original version – the majors changes were generics in Java 1.5 and annotations. Sadly, Java 1.7 is not going to bring any major changes – no properties, no better generics – only some better type inference which should have been there from the start.

With .NET 3.5, Microsoft added a bunch of functional programming into C# probably with Linq. It doesn’t make C# a fully functional language – functions aren’t fully first class citizens of the language. Linq uses some of the new language features and adds many functional functions to many core classes. The most useful ones are on the collections, functions such as sort and aggregate take fully advantage of functional programming. In addition, Linq provides ways to query collections and other objects (I haven’t explored that one too much).

One of my favorite language features are extension methods. It allows to add methods to any objects. I’ve seen this also in Scala but the elegance of the C# approach is the simplicity:

public static fuzzyMatch(this string a, string b) { blabla stuff; }

adds a new method to the string object, voila no lengthy declarations or keywords.

I did not use F# too much but it is a strong functional language. I learned CAML (F# has been inspired by CAML) – probably 10 years ago in the university – and I really thought it will be the least useful thing. I don’t really like the F# syntax – OO stuff doesn’t seem straightforwar. One annoying thing though, you can mix C# and F# but not inside a single project.

2. Visual studio and tools

Testing

The most serious issue is IMO testing. First of all, the test runner, framework and wizard come only with the commercial version of visual studio. They provide all the goodies (code coverage and a complex unit testing framework). Providing the testing framework in specific editions is IMO  a great mistake – it won’t reinforce a good testing culture – and testing tools should be first class citizens.

Plus Visual Studio doesn’t have the instantaneous feel of running tests in Eclipse. With Eclipse, in a click you run the tests, no extra compilation nor anything else is necessary. In Visual Studio, something feels heavyweight, changing to the test view is sluggish, everything requires a recompilation of all the projects (which is lightning fast though). The tests outputs aren’t either too friendly, it takes quite a bit to understand the output of a test.

The wizards are ok (they can generate all testing stub code) and generate quite a bit of extra stuff. One nice detail though, you can generate tests for private methods and classes through some kind of generated accessor. I’d like to see this in Java.

SharpDevelop – an open source alternative to VS – has built-in NUnit support and the whole IDE feels snappier than VS. I end up doing most of my code with it.

In VS, there is one great idea for testing database based projects though: database projects. They allow to add creation scripts, scripts to add data and others to delete data. And all of this is part of the automation when you launch tests and runs.

Deployment and build

For simple applications, these two elements are usually separate but Visual Studio has an interesting way of managing the builds. When you build a project, all the dependencies are copied into the bin\<Release or Debug> including configuration files and when you run or debug, the application is launched from there. The beauty of it, is that if you need to deploy the application, you only need to copy the Release directory and launch the .exe file. This is elegant compared to Java applications. With Java and Eclipse, to start you need to write a build script. there are tons of setups for dependencies and different types of descriptors (although it is certainly easier with Maven), a classpath for the Eclipse project and then when you need to run the application, you need to manage another classpath.

Not to mention configuration files… There are tools to ease this with Java and generate scripts but still the java commands are a real pain. Probably because of the sacred “backward compatibility”. You can probably still run Java 1.1 applications with the latest JDK without any change. And the price is that writing an application in a Java IDE, then running it outside the IDE is difficult and shouldn’t be. Sun did try to “patch” the problem with executable jar files, and Java web start, but both of these don’t simplify having to configure independently each dependent jar file instead of just loading all the dlls in the same folder.

Others

Adding dozen of jar files to an Eclipse project can be quite annoying. In the Java world an elegant solution is provided by avenare Maven projects. can simplify that and manage the dependencies for you. Well, with VS and .NET, there is nothing equivalent and the dependencies can be a real mess.

If you come from the Eclipse world, you are used to “free” refactoring: rename members, fields, methods, etc is built-in in most of the major open source IDEs. With Visual Studio, this is a “commercial” feature and is not in the free version. SharpDevelop has some limited refactoring built-in.

Also the .NET platform doesn’t have yet the same ecosystem Java has. You can build almost any enterprise applications with all the existing open source projects.

3. Conclusions

I’m quite impressed with the C# language and the whole .NET platform. C# is truly elegant and the language team has put some great though on how to add functional programming and other new features to the language. This really makes a difference in the end of the day – all these features improve the code readability and avoid creeping the number of code lines to perform basic operations.

I was also glad to loose the overhead of deployment and be able to simply copy directories to deploy an application. Maybe Oracle might be more courageous than Sun and really improve the language itself even at the price of backwards compatibility. Java needs a real new version.

Presentation about Maven and open source testing tools at OSQA

If you are interested in Maven and managing builds, documentation, dependencies, releases and distribution, you should come to my talk at the Ottawa Software Quality Association.

DATE: Wednesday, May 20, 2009
TIME: 6:30PM Networking; 7PM-9PM Presentation
PLACE: TheCodeFactory, 246 Queen St., 2nd floor, Ottawa (between Bank and Kent, above the Green Papaya Restaurant)
COST: $10.00, free for members
TO REGISTER: send an e-mail to suggestions @t osqa.org with a subject REGISTER FOR MAY

Never too late

I’ve been thinking about creating a blog for a while – many of my colleagues have one, this has been in my todo list for a while and I decided that it was time to start.

Let me introduce myself, I’m I was researcher in software engineering and since I had my Ph.D., I’ve been working on a wide range of topics, from middleware to AOP, performance analysis and more recently business rules and legacy systems. I’ve been trying to take any occasion of working on real world data and problems to make advances.

My most recent work deals with recovering business rules from legacy systems, I developed a tool that analyses legacy COBOL code, extracts business rules and links data sources to documentation – to enable business analysts to understand what is happening in a legacy program. See my resume for more details. But since yesterday, the software engineering group at IIT – NRC has been closed, so this project has been stopped as well (plus as a side effect, I need a job now).