I can't stop surprising by all that cool language features Groovy provides. I like learning them by example. This time it is calling methods asynchronously in Groovy, part two - using Categories. This is not that easy to implement (though it's easy enough) compared to methodMissing approach, however it lacks all that disadvantages of overriding handlers.
Briefly, it uses closures, and functionality provided by use keyword. I guess it could be improved to make the whole thing less verbose, but right now I have no time to think about it. Tried to do something similar in Java using AspectJ, but stuck due to Java syntax limitations due to absence of closures. Using anonymous classes here and there looks ugly and is not less verbose nor easier to understand than straightforward approach.
I wonder if some kind of closures can be implemented in Java using aspects. Haven't found the solution yet.
Thursday, January 29, 2009
Tuesday, January 27, 2009
Some business rules resources
In the recent project we used Hirix XRules business rules engine (you would barely find any information on it anywhere, because it's an IBM internal tool), which appeared to be buggy and slow in our web environment. So, we switched to native Groovy code then and implemented all our rules (supported by more than 700 pages of very brief documentation) and underlying rules engine. I've spent about three months optimizing and polishing it, and in the end it has a very good performance, outperforming the initial solution by more than 100 times.
Why haven't we used some off-the-shelf product instead? Well, mostly because we lacked information, were limited in time and virtually all other resources. So now when I have time to investigate (the project is over), I found some neat stuff about it:
Why haven't we used some off-the-shelf product instead? Well, mostly because we lacked information, were limited in time and virtually all other resources. So now when I have time to investigate (the project is over), I found some neat stuff about it:
- Rule Based Systems: Why use a rules engine
- Drools features and screenshots (damn, I love these screenshots!)
- Complete site about Business Rules (still under construction I guess)
Friday, January 23, 2009
Cool Groovy feature
I found a smart article, where is described how to add very easy-to-use support for asynchronous execution to Groovy code by hooking into methodMissing.
Thursday, January 22, 2009
HTTPUnit in DB2 stored procedure
That was nightmare - running HttpUnit as a stored procedure (don't ask me why) on 8.2 was crashing db2fmp to heap dump. After two days tossing xercesImpl.jar here and there, I decided that was enough and upgraded DB2 to 9.5 Viper-2! Pretty cool XML support and a lot of other large-scale-supporting stuff, but all I need is stable interpretation of my precious stored procedure.
And guess what? It works! More or less... Xerces still unable to find something important inside HttpUnit, but at least no crashes. I guess it's because Xerces uses something internal as a classloader, that's why they have so many problems with shared libraries, etc. So, I've just put that nasty JARs here and there and everywhere (yes, that's not any kind of production system, just a learning application) and now it seems working fine. Well, I'm not sure yet, because it's quite a long-running procedure, but I will know for sure in about ten minutes.
Keeping my fingers crossed + +
UPD: Yes, it works finally. Also, I've found a nice article about HtmlUnit vs HttpUnit. Damn.
And guess what? It works! More or less... Xerces still unable to find something important inside HttpUnit, but at least no crashes. I guess it's because Xerces uses something internal as a classloader, that's why they have so many problems with shared libraries, etc. So, I've just put that nasty JARs here and there and everywhere (yes, that's not any kind of production system, just a learning application) and now it seems working fine. Well, I'm not sure yet, because it's quite a long-running procedure, but I will know for sure in about ten minutes.
Keeping my fingers crossed + +
UPD: Yes, it works finally. Also, I've found a nice article about HtmlUnit vs HttpUnit. Damn.
Wednesday, January 21, 2009
Artima Developer Spotlight Forum - Java Properties without Getters and Setters
Here is described an elegant way of implementing C#-like properties in Java (1.4+) using AspectJ. Nice try, though quite a useless one in a modern reflection-based Java world... Such things make me consider learning AspectJ in a more detail.
My first entry AKA disclaimer
Hello, I'm a software developer in a major Belorussian IT company, and I think that's all you need to know about me at the moment :)
Firstly, it was surprisingly easy to create that blog, thanks to blogger.com! I'm not a native English speaker (actually, I've born in ex-USSR country), so don't get confused with it please.
I think this will be mostly IT-related blog, where I'm going to collect my favorite links, articles, etc.
Firstly, it was surprisingly easy to create that blog, thanks to blogger.com! I'm not a native English speaker (actually, I've born in ex-USSR country), so don't get confused with it please.
I think this will be mostly IT-related blog, where I'm going to collect my favorite links, articles, etc.
Subscribe to:
Posts (Atom)