Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between public interfaces and published interfaces in Java? [closed]

Tags:

java

interface

I've read these two pages

  • http://martinfowler.com/ieeeSoftware/published.pdf
  • http://lambda-the-ultimate.org/node/1400

but I still don't get the difference between a published and public method. An example in Java would be helpful. Thanks in advance.

like image 637
user3145085 Avatar asked Oct 18 '25 18:10

user3145085


1 Answers

public

Public interfaces written in Java:

    interface MyInterface { ... }

    public interface MyInterface { ... }

    class MyClass() {
        void anotherInterface() { ... }
        public void someOtherInterface() { ... }
    }

All of them are public because they are not only available for internal objects.

published

The status of published interface is not part of the Java language, it is part of what some may call application architecture. It is in a higher level of abstraction.

Now, the relationship between the two:

  • Every published interface is a public interface.
  • Not every public interface is a published interface.

Note: The concept does not apply literally to only Java interfaces, it could also be class, methods etc.

To dig deeper: Public versus Published Interfaces

like image 133
givanse Avatar answered Oct 21 '25 14:10

givanse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!