Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6623459

Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern

    XMLWordPrintable

Details

    • b27
    • generic
    • linux
    • Not verified

    Description

      Prior to Java 5, there was an ugly approach in using constant values named as Constant Interface Antipattern. To keep constants at one place and make them accessible in different classes of the application, it was a custom to define an interface containing all constants, other classes had to implement the interface wherever those constants were required.
      This approach conflicts with the object orientation of Java language. Such constants are implementation details for a class but if the class accesses them by implementing an interface they become a part of public access (API) of the class. It means implementation details are being linked as API here.
      Constant imports could be used as a replacement.

      Attachments

        Activity

          People

            dav Andrei Dmitriev (Inactive)
            dav Andrei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: