Posts

Showing posts with the label java 5

This Blog Has Moved!

Right, so yes, five years ago I moved to github pages, and never bothered to redirect any of these pages there. Now I've moved on from there, and... Finally I am using my real domain, trishagee.com . My blog is now at trishagee.com/blog .  See you there!

AOP Caching

Today I would like to document my experiences implementing caching with Aspect Oriented Programming (AOP) and annotations.  Background context   Caching may need to be implemented in your application for a number of reasons. OK, actually usually only one: performance. I would like to add my own tuppence-worth to this though - if you can get away without caching (specifically in application that provide the ability to view and change data) then do so, unless you are using a cache implementation that will handle as much of the pain as possible for you. Implementing a home-grown cache from scratch is almost never the correct thing to do in my experience, you spend lots of time debugging and tweaking the cache when you should be working on your day-job, not re-inventing something that someone, somewhere, has already done a perfectly good job of .  The example I'm about to show you is for a web application created to let users read and edit values from a database (not an unusu...

Java Specifics

When I first started playing with Java 1.5, I thought generics were the best thing since sliced bread. No more untidy casting, lovely type-safe Collections, and when combined with the new for loop , a lot of the tedious tasks associated with Collections became easier and, most importantly, aesthetically pleasing. Consider the old code: List list = new ArrayList(); list.add(new Integer(1)); Integer integer = (Integer)list.get(0); for (Iterator i = list.iterator(); i.hasNext(); ) { Integer number = (Integer)i.next(); number.intValue(); } And the new: List<Integer> list = new ArrayList<Integer>(); list.add(new Integer(2)); Integer integer = list.get(0); for (Integer number : list) { number.intValue(); } See? Much prettier. OK so it's a silly little example but when you apply it to all the places you use things like Collections it does make life a lot easier, especially when you consider that now you *k...

Popular posts from this blog

Dissecting the Disruptor: Writing to the ring buffer

Dissecting the Disruptor: What's so special about a ring buffer?

Dissecting the Disruptor: Demystifying Memory Barriers