Posts

Showing posts with the label code

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!

Interview and Hacking session with Stephen Chin

Image
On Monday, Stephen Chin from Oracle visited me at the 10gen offices as part of his NightHacking tour .  In the video we talk about my sessions at JavaOne and the Agile presentation I'm giving at Devoxx, and I do some very basic hacking using the MongoDB Java driver , attempting to showcase gradle at the same time. It was a fun experience, even if it's scary being live-streamed and recorded!

A chance to see some of my actual code (even if it is C#)

Remember I posted about having to write .NET ? Well, the code and the tutorial are available for you, my lucky readers, to rip to pieces view. I am not the only person responsible for this code though, so be kind.

Why Java developers hate .NET

I have been struggling with .NET.  Actually, I have been fighting pitched battles with it. All I want to do is take our existing Java client example code and write an equivalent in C#.  Easy, right? Trisha's Guide to Converting Java to C# Turns out writing the actual C# is relatively straightforward.  Putting to one side the question of writing optimal code (these are very basic samples after all), to get the examples to compile and run was a simple process: 1. Find-and-replace the following (only you can't use Ctrl+R like I expect.  Sigh.) final = readonly (but remove from method params) System.out.printf = Console.WriteLine Map = Dictionary BigDecimal = decimal Set ... oh.  I have no idea. 2. When using callbacks, replace anonymous inner classes with delegates Java something.doSomething(new SomethingRequest(), new SomethingCallBack() { public void onSuccess() { System.out.println("Action successful"); } public voi...

Validation with Spring Modules Validation

So if java generics slightly disappointed me lately , what have I found cool? I'm currently working on a web application using Spring MVC , which probably doesn't come as a big surprise, it seems to be all the rage these days. Since this is my baby, I got to call the shots as to a lot of the framework choices. When it came to looking at implementing validation, I refused to believe I'd have to go through the primitive process of looking at all the values on the request and deciding if they pass muster, with some huge if statement. Even with Spring's rather marvelous binding and validation mechanisms to take the worst of the tasks off you, it still looked like it would be a bit of a chore. Given all the cool things you can do with AOP etc I figured someone somewhere must've implemented an annotations-based validation plugin for Spring. And they have . And there's actually a reasonable amount of information about how to set it up and get it working. The pr...

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