5

In my time of digging around Java APIs I have come across both impl and internal packages. Up until now I never really thought about the difference - as with all enterprisey Java apps, I figured they just meant that "actual implementation in here; you (API user) should be really using the interface. Go away."

A little bit of digging around Stack Overflow seems to suggest that the internal package at least can have some security placed around it.

So, what is the difference? I don't think it is a matter of taste because I have seen APIs with both.

Community
  • 1
  • 1
Ben J
  • 5,811
  • 2
  • 28
  • 32
  • 3
    I think is is a matter of taste and design. As long as you make it clear which packages/class are intended for internal use only, that is what matters. Note: OSGi has stricter controls over which packages are "exported" and which are for internal use only. – Peter Lawrey Feb 04 '11 at 23:23

1 Answers1

2

The package name has no implication on the runtime behavior. It is just a matter of taste. Some modularity systems like OSGi, give you tighter control in the manifest file over what's visible vs. not to downstream module, but that's all done explicitly not via naming convention. At least in OSGi circles, "internal" is the established naming convention over "impl". Lexically it is more general than "impl" so by extension more broadly applicable... Everything that code outside the module should not touch.

Konstantin Komissarchik
  • 28,879
  • 6
  • 61
  • 61