Loading ...
Sorry, an error occurred while loading the content.

RE: Refactoring problem

Expand Messages
  • Glen Stampoultzis
    ... Is it true at all in Java? If their were dependancys on the whole interface (rather than just the method) then Java programs would break with every
    Message 1 of 3 , Oct 1, 2000
    • 0 Attachment
      >In Python or smalltalk the client does not depend upon the declared
      >interface of an object. If the object has 7 methods but the client
      >only uses 1, the client is completely unaffected by any change made
      >to the interface of the other 6 methods. No recompiles, no
      >redeployment, no nothing. The interfaces of the methods of an
      >object in Smalltalk and Python are all segregated from each other.

      >Whereas in Java or C++, the client of an object has a hard
      >dependency upon the *set* of declared methods for an object; even
      >if it doesn't use some of those methods. A change to the
      >interface of a method that the client does
      >not use, can still affect the client. (More in C++ than in Java).

      Is it true at all in Java? If their were dependancys on the whole
      interface (rather than just the method) then Java programs would
      break with every release of the JDK.

      Regards,

      Glen
    • John Brewer
      ... Fortunately, Java allows (and the language spec requires) certain chages to maintain binary compatibility . For example, you can add public methods to
      Message 2 of 3 , Oct 2, 2000
      • 0 Attachment
        --- In extremeprogramming@egroups.com, "Glen Stampoultzis"
        <glen_stampoultzis@a...> wrote:
        > >Whereas in Java or C++, the client of an object has a hard
        > >dependency upon the *set* of declared methods for an object; even
        > >if it doesn't use some of those methods. A change to the
        > >interface of a method that the client does
        > >not use, can still affect the client. (More in C++ than in Java).
        >
        > Is it true at all in Java? If their were dependancys on the whole
        > interface (rather than just the method) then Java programs would
        > break with every release of the JDK.

        Fortunately, Java allows (and the language spec requires) certain
        chages to maintain "binary compatibility". For example, you can add
        public methods to interfaces and classes without breaking binary
        compatibility. However, if you change the type signature of a method
        (as opposed to adding a new method with the new signature) that would
        break binary compatibility, and you'll need to recompile all classes
        the depend on the changed class.

        See:

        http://java.sun.com/docs/books/jls/html/13.doc.html

        for all the gory details.

        John Brewer
        Jera Design
      Your message has been successfully submitted and would be delivered to recipients shortly.