30 September 2008

Templates and Exceptions in C++

It's quite funny to read about Templates and Exceptions in C++, after having used them extensively in Java and never in C++ (well, call the first ones generics).
They were so advanced, for the time, but in the case of exceptions, a bit limited: in C++ you can just catch integers, while in Java you catch objects of type Exception.
I've heard people saying that C++ templates are far more powerful than Java generics. I don't know exactly why but the fact is that Java generics are a mess so people stay away from them, or use them as little as they can.

23 September 2008

ActiveObjects: An Easier Java ORM

In my little experience with Hibernate, I had to port code from C# to Java.
While doing so I got rid of dreadful data sets and introduced the use of Hibernate.
Having to import an existing database scherma, I used the Hibernate Tools for Eclipse to generate the required XML configuration files.

In my view choosing Hibernate over data sets has improved a lot the existing code by getting rid of tons of SQL that was scattered all over the place.
Plus it has inforced good decoupling of business and data access logic so that it is now trivial to switch over to a different database vendor.

Apart from some intricacies with native and composite keys, my experience with Hibernate has been pleasant,
The only issue I have with the ORM is its slow startup and the fact that it relies on a ton of external Jars (the same reason why it's quite hard to package Hibernate as an OSGi bundle).

For a future project of the same (small) size, I will definitely look at a new, smaller ORM.
Here are some links:

ActiveObjects: An Easier Java ORM
https://activeobjects.dev.java.net/