I've been very busy these past months implementing all kinds of cool new things. Of course I always intend to do some marketing for them, but once each problem is solved, it loses its glitter and I quickly focus on the next cool thing. I know I really should take time to make the community aware of new capabilities, because it makes those things more valuable in reality, but I still prefer to focus on development. Oh well, we all know where the road paved with good intentions typically ends.
ResourceSetImpl.ResourceLocator, something I added in EMF 2.8, because they don't know they can. You can see how it's used in the unit test, i.e., just create it and you're done. What does it do? It allows ResourceSet.getResource to find the resource without searching the whole resource set. If you look closely at how it's normally implemented, you can see it uses quite an expensive linear search that is made even more costly by the need to normalize each resource's URI to do proper comparison. By adding a locator, the cost reduces to a fast mapped look-up where the performance is independent from the size of the resource set. Most importantly, the map is properly maintained, so no matter what you change, including changes to the URIConverter's URI mappings, you'll always find the right resource in constant time. So if your application has a large number of resources, your should consider using it.
The most recent example of a cool new feature is support for reified types. You'll only notice this change if you use generics extensively and you regenerate your model, assuming I've not broken anything in the process, because then you might notice sooner! Consider the following model:
In other words, the generator will ensure fail-fast, type-safe behavior. Not only that, the edit support is also enhanced. That is, you can create any type of thing in a container.
Similarly, you can select any type of element in a container.
But you can select only a menu element in a menu.
How cool is that? You might ask yourself, who would model in this way? Look closely, you'll find it right under your nose. I have the good intention to blog about other cool things you probably didn't realize were available.
Use and misuse of statistics
2 years ago