Monday, May 26, 2008

Aproximation of approximation of ...

Approximation is sometimes only way to make something reasonable.
What is the problem:
When you are adding new transformation you need to describe for which plug-ins it should be applied.
Now simple approach is taken - choose the first one found. The problem is that it can return strange errors when you will add new pattern which also matches other plug-in.


We've been talking how to deal with that and most reasonable approach is to find most specific pattern that matches resource name. But as we need fast solution we decide use something that have chance to work better than simple "choose first" approach.
First take all matches and choose the best one of them. What choose the best means ? Choose most specialized pattern.
From my observation seems that patterns are rather simple and choose the "longest pattern" strategy should work in most cases.
So ? Choose the exact name or the longest pattern.
I am far from claiming that this solution is working in all cases. In fact there are thousand of examples it's not. But it gives you answer when you will find some unexpected result and want to check which pattern was applied.

No comments: