In JavaLanguage, classes can be either top-level or ''inner'', nested within another class. How do you decide whether a new class should be top-level or inner? Forces for making an InnerClass: * The InnerClass is only relevant in the context of the outer class. See InnerClassesAreSecondaryAbstractions for an example. * The candidate class can be made private, so that only the outer class can access it. * The outer class needs to act in a role as some other class or interface type, but that other type isn't prominent enough in the responsibility of the outer class to warrant extending the type directly. (If the other type is a class, rather than an interface, the outer class may be unable to extend it.) The inner class can serve as a ''mask'' or ''facade'' for the outer class. Forces against making an InnerClass: * The InnerClass is large enough that it makes it hard to read the outer class. * The InnerClass is itself nested with an inner class. Some humans will find it difficult to keep track of this. * The InnerClass can be used whether or not the outer class is used (in other words, the InnerClass is a "primary abstraction"). ---- Is there a downside to avoiding Java InnerClass''''''es in general? I only use them to simulate multiple inheritance ''(see BizarreLoveTriangleInJava)'' and function pointers ''(actually LexicalClosure''''''s)'', and I never use anonymous or static InnerClass''''''es. Code without InnerClass''''''es seems more readable and maintainable. JaredLevy See InnerClass''''''es ---- In Microsoft VisualCeePlusPlus you have to use InnerClass''''''es when you want to imitate the functionality of PartialTemplateSpecialization, which Microsoft have not implemented but which is necessary for many of the new C++ idioms. /////////example of using inner classes for PTS in CeePlusPlus /////////// template struct Bar { template struct Foo { static int f(S s, T t){return 0;} }; template <> struct Foo { static int f(S s, T t){return 1;} }; typedef Foo Imp; }; template int foo(S s, T t) { return Bar::Imp::f(s,t); } ////end of example of MSVC pseudo partial template spec. using inner classes ///////// Unfortunately I don't think the resulting code is strictly legal, but QuasiC++ aka MSVC seems happy enough with it. BillWeston