This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Originally posted by Paulo Freitas: Are nested Interface classes a good programming practice or is there any other workaround to better address this kind of implementation?
Well, you can always work around this by putting the class outside the interface. Is a class enclosed in an interface good programming practice? Well, this is probably getting close to a religious debate about what is good and what is not good practice. However, my opinion is this: If a class is so tightly coupled with an interface that the interface relies on that class in order to compile (such as returning an object of that class type) AND no other class uses that class outside of the methods defined in that interface - then, maybe it's okay. In case you can't tell from that statement, I find classes enclosed within interfaces to be a bit confusing (not that they're hard to understand, you just don't see them often). So, I tend to shy away from them. So, there's the "wishy washy" answer for the week. :roll: I think it can be acceptable in some cases, but I certainly wouldn't make a common practice of it. Corey