Proving a point
With my posts on reflection optimization for .NET and Java, I unconsciously proved a point from an earlier post on cultural movements within the .NET-community. I use a lot of open source frameworks in my work. One cool benefit this gives me is that it is amazingly easy to move between Java and .NET development. Consider these two examples from my previous posts:
public static T Clone<T>(T obj)
{
IReflectionOptimizer optimizer =
GetReflectionOptimizer(typeof(T));
T clone =
(T) optimizer.InstantiationOptimizer.CreateInstance();
optimizer.AccessOptimizer.SetPropertyValues(
clone,
optimizer.AccessOptimizer.GetPropertyValues(obj)
);
return clone;
}public static <T> T Clone(T obj)
{
ReflectionOptimizer optimizer =
getReflectionOptimizer(obj.getClass());
T clone =
(T) optimizer.getInstantiationOptimizer().newInstance();
optimizer.getAccessOptimizer().setPropertyValues(
clone,
optimizer.getAccessOptimizer().getPropertyValues(obj)
);
return clone;
}
At first glance these two look the same, but there is a huge difference. The first example is C# code using NHibernate while the other is Java code using Hibernate. Things like slightly different generics syntax, naming conventions and language idioms are really just details.
The cool thing is that it is becoming easier and easier to be a bilingual developer.
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using