16 Nov
2009

Why Future<T> should be in your future

Category:UncategorizedTag: :

Even though NHibernate 3.0 is on the way I am going to highlight a feature that was introduced in v2.1 but that relatively few people seem to be using (at least in the code bases I have seen recently). Former ECer Davy Brion, as always, does an excellent job of demonstrating usage of the feature here so I am not going to rehash that. What I am going to focus on here if the why.

Building a UI can be a very database intensive operation in terms of the number of separate calls required. And for each one of those calls the time taken to actually execute the query can be a small compared to the duration of the roundtrip to request and fetch the data. The obvious solution is some type of batching and with Future<T> this happens automagically without any change to the consuming logic (for databases that support it). Let me restate that, you get a huge performance benefit with only a simple change to your query methods in the Repository. So why aren’t you using it?

2 thoughts on “Why Future<T> should be in your future

Comments are closed.