Archive for the ‘Java’ Category
At work, we have multiple libraries that provide us with small small functionalities. This design keeps things simple and makes code sharing easy. But it also has it’s own set of problems. In very large projects where there are multiple branches and complicated dependencies, it’s impossible to ask customers to provide you with jar versions. [...]
There’s no doubt that Joda time is now the defacto date time library for java. And a well written library it is. You get almost everything you can ever want to do with Date objects and best of all, almost all operations are dummy-proof. By dummy proof I mean that programmers making silly mistakes can’t [...]
Over the last couple of years I have had various discussions about this with my colleagues. I myself favoured foreign keys relationships rather than join tables till a little while ago. If you’re not aware of how to do one or the other, the eamples below should explain that. Consider a very simple parent child [...]
I had an interesting discussion with a colleague of mine regarding the differences between the proxy and the decorator pattern which made me give it some thought. To the untrained eye (that includes my eye!), they seem exactly the same. Infact you sometimes wonder, why the heck are there two names for the same pattern. [...]
I’m a bit ashamed to write this post. I have been working on Java 5 for well over two years and yet I was unaware of the power of the java.util.concurrent.TimeUnit class. While I have used almost all the other juc classes over this time and subsequently TimeUnit as well (in some of them), I [...]
It’s ironic the stuff we get used to as developers. There’s so much we do repeatedly in every class or in every project or maybe even in every method yet we never realize that it’s probably best to add a new “feature” to java to make our life easier. While searching for some reading material [...]
In-memory cache’s can be extremely useful for small web applications where you don’t want to full-blown cache system like ehCache or simply can’t afford one. I recently had such a requirement and I must say that I kind of made a mess of it. The requirement was to cache User objects so that we didn’t [...]
I have noticed a lot of people on the internet asking about method inlining. The term generally arises whenever the final keyword is discussed. Basically, it is said that compilers inline methods which are declared final thereby avoiding the cost of putting them on the stack etc and thus improving performance drastically under heavy load [...]
ConcurrentHashMap is a pretty ignored class. Not many people know about it and not many people care to use it. The class offers a very robust and fast (comparatively, we all know java concurrency isn’t the fastest) method of synchronizing a Map collection. I have read a few comparisons of HashMap and ConcurrentHashMap on the [...]
More often than not you need your java program to perform an operation at a particular time. It gets trickier when the operation needs to be performed at regular intervals. There are a lot of solutions to implement a java “cron” of sorts available. There’s the quartz scheduler which has pretty much everything that you [...]
I’m asked the difference between the two interfaces, Serializable and Externalizable more often than i’d like. It’s pretty simple really. Serializable does all the dirty work for you, it writes the object to the output stream on it’s own without you having to bother about anything at all. Externalizable on the hand makes you do [...]
Of all the new topics in Java 5.0, the most confusing has been Generics, atleast for me. I realised that, while studying for SCJP 1.5, I would need a summary of generics so it doesn’t escape me a little while later.
Calling International from India has always been a … pain to say the least. First off, getting through was impossible. Notice how I say “was” because that was the case in the early and mid 90′s. With the entry of private operators into the field, things got easier because the state monopoly was over. Getting [...]
I stand corrected. I always though things like these were about 100 times more likely to happen in a third world country than in a “union”, european union more specifically. I’m talking about the recent .eu domain name fiasco. Simply put, Pool.com a registrar, cheated to obtain .eu domains on the first day of the [...]
