Archive for the ‘java’ Category
Tuesday, July 17th, 2007
As I have always had problems with Java’s checked exceptions, I had a little debate with Debasish in the comments section of his recent blog post regarding exceptions in DDD. Over there, I concluded my case with: more…
Posted in java | No Comments »
Monday, June 18th, 2007
Here goes my version of the maze solver program to the Excellent Interview Question Shane Bell wrote about. My solution follows the classic “always keep your left hand on a wall” idea. It doesn’t guarantee to find the best route, but then it being non-recursive doesn’t blow up the stack with a large maze, and it at least eliminates all the loops.
Posted in java | No Comments »
Tuesday, May 29th, 2007
Spring-AOP is implemented by creating proxies decorating the target bean. One typical gotcha from using these proxies, for instance, in declarative transaction management, is the proxy can’t intercept a call made from one method to another on the same target object (typically a service bean), even though both methods are supposed to be wrapped by the proxy. more…
Posted in aop, java, spring | 2 Comments »
Monday, April 9th, 2007
Having recently been severely frustrated by that other ambitious Apache project that aims at “making the build process easy”, and “providing guidelines for best practices development”, etc. – OK, who am I kidding? Yes, I’m referring to maven 2.
– I turned my eyes to Ivy, and, after a couple of week of using it, found myself comfortable enough to write this to recommend Ivy as an indispensable part in any serious Ant-based build tools arsenal. more…
Posted in java | 2 Comments »
Wednesday, February 28th, 2007
YUI has been my favorite AJAX library for two reasons: its unintrusiveness to the server side, and the excellent documentation. It is interesting and encouraging to see Yahoo offer free hosting for YUI. While there are obviously valid reasons for some sites not to use this service (external dependency etc.), the power of yahoo’s server facility, the advanced cache control, and the on-the-fly file size reduction (up to 90% according to the announcement linked) are in no doubt going to be very appealing to many others. more…
Posted in java, web-design | No Comments »
Tuesday, February 27th, 2007
I just wanted to expand on Richard Relos’s we don’t really need closures in Java into a broader argument – syntax sugar is the least of what Java really needs now. more…
Posted in java | 6 Comments »
Monday, February 26th, 2007
I have been interviewing a number of folks to help filling up some Java developer positions. More than one of them (mind you, referred through different sources) told me, as part of the answer to “how would you implement a singleton?”, that I must override clone() to make sure my previous singleton wouldn’t get, well, cloned. And they all told me that they learned it “somewhere,” only unsure where that “somewhere” was.
I did some googling and actually found a couple of “Java tutorial” sites that tell people to override clone() as part of a “standard” singleton implementation. I won’t be linking to any of those sites for the obvious reason of not wanting to bump up their google rankings. And I’m just gonna post some kind of “counter-jinx” here:
If you are preparing for an interview, and happen to stumble upon this blog, please, please remember that Object.clone() by default throws CloneNotSupportException if the class does not implement Cloneable, and I don’t really think you would want to tell your interviewer that you wish to have your singleton class implementing Cloneable. So, no, it’s completely unnecessary to override the clone() method in a singleton implementation.
Posted in java | 3 Comments »
Sunday, January 14th, 2007
The new BeanDefinitionBuilder class added in Spring 2.0 allows an XML-less way to build application contexts programmatically. Can be very useful for, say, creating quick testing setups in one of those script languages. more…
Posted in java, spring | 12 Comments »
Saturday, January 6th, 2007
The standard Ubuntu repository has only 1.3.2. Higepon’s tips worked very well. In addition to the packages listed, I had to also install ‘expat-dev’.
Posted in LAMP, Ubuntu, java | 1 Comment »
Tuesday, December 12th, 2006
(Traceback to Weiqi Gao’s post)
Considering “.” is used as the accessor universally for all properties and methods in C#, as well as most script languages Java 6 has just made easier supporting, I for one would be very interested in learning the rationale behind using -> for property access – it’s got to be a conscious decision.
Another thing that had some coffee-spilling effect on me was the “Closures, Lambdas and friends” part. On the first look, I thought they were adding “friend” support in Java 7 (as in C++), which would have been a good thing.
Posted in java | No Comments »