On Fri, 08 Apr 2011 10:36:39 -0400, Andrej Mitrovic <[email protected]> wrote:

On 4/8/11, Bruno Medeiros <[email protected]> wrote:
On 05/04/2011 04:54, Andrej Mitrovic wrote:
You have to be kidding me. Who writes code like this?

http://i.imgur.com/BBQde.png

What's wrong with it?  Do you mean the anonymous classes with all the
fields and contructors for passing the variables in the enclosing scope?

--
Bruno Medeiros - Software Engineer


I don't understand the need to create huge anonymous classes. If
you're going to create or override so many methods, you might as well
create a new class instead of embedding one in the call.

Maybe that's a standard way of doing it in Java, but I'd never code
like this. Maybe it's because I don't depend on an IDE, and like to
keep my code clean. I'm not a fan of deeply nested code.

I think the reason it looks like this is because Java does not have delegates. Anonymous delegates are much easier to read, and also do not take up heap space.

If anything, I'd say a very worthwhile project would be to change all the callback interfaces and anonymous classes to delegates.

-Steve

Reply via email to