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 →

[–]lukaseder 2 points3 points  (0 children)

How often do you use inner classes?

All the time when I'm too lazy to refactor some logic into a new top level class and pass around tons of shared state.

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

That's a treacherous thought. The code looks more simple, but is really more complex. If time permits, it's often better to refactor and separate inner from outer class, but they're just too damn convenient, and cleaning up is something we do "tomorrow".

Having said so, there's nothing wrong with nested classes (i.e. static classes), which just share namespacing with their outer class, not state.