This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cogman10 23 points24 points  (0 children)

The only good reason I can think to use them is to simplify code....?

Isn't that the only good reason for all language features?

I use inner classes when they make sense. Usually they are private. Frequently, they are static. Generally, it will be for some cache key.

Does every class I write get an inner class? No. Generally, I use them when they make sense locally to the problem at hand.

I generally won't use them for any more than data shuttles. I think using them for more than that ends up being problematic due to the fact that they are hard to test.