Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • 88
    I'm not the downvoter, but the fact this answer is something that could be called "normative" (ie. "you should" instead of "in fact ... however ...") is the most likely reason for it to get a downvote I think. It doesn't actually answer any of the questions. Like raising an irrelevant exception instead of returning anything / raising an exception that has information about actual facts instead of opinions. Commented Jul 6, 2012 at 6:19
  • 6
    I found what I think is a minor exception to @JonSkeet 's suggestion to use a nested type (which I would otherwise agree with): if the main class is generic and the type parameter is the second class, the second class can't be nested. And if the two classes are tightly coupled (like PublicClass and PrivateImpl in the question), I think it's a good idea to put PrivateImpl as a top-level class in the same file. Commented Nov 16, 2012 at 18:13
  • 6
    @BoomerRogers: No, this is definitely not the "core basis of component based programming". If you're programming against a component, why would you care how the source code is organized? (Personally I prefer dependency injection rather than the service locator pattern, but that's a different matter.) Separate API and source code organization in your mind - they're very different things. Commented May 22, 2014 at 10:50
  • 3
    @JonSkeet Let me rephrase: Your "answer" is a personal irrelevant opinion. (i.e. answers like "mess" and "i doubt it" have little value.) So, your post does not answer any of the 2 posed questions. Check the answer of polygenelubricants, and you will see that he manages to answer both. Commented Apr 6, 2015 at 15:08
  • 1
    @bvdb: (And there are lots of things which are bad practice but allowed by the spec. I would urge people not to write public int[] foo(int x)[] { return new int[5][5]; } as well, even though that's valid.) Commented Apr 6, 2015 at 15:50