How the concept of module is different from concept of package?


 Java has the notion of a package, which is typically used for partitioning code. For code to be visible from
one Java package to another, the code must be declared public (or protected if using
inheritance). Sometimes the logical structure of your application calls for specific code to
belong in different packages, but then this means any dependencies among the packages
must be exposed as public, which makes it accessible to everyone else too. Often this can
expose implementation details, which makes future evolution more difficult since users may
end up with dependencies on your non-public API.

Whereas, OSGi's export-package entry in metadata enables us to reveal only necessary details .

Comments