Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-7867

Expose collection interfaces, not implementations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 3.0
    • None
    • Frontend
    • None
    • ghx-label-2

    Description

      When using Java collections, a common Java best practice is to expose the collection interface, but hide the implementation choice. This pattern allows us to start with a generic implementation (an ArrayList, say), but evolve to a more specific implementation to achieve certain goals (a LinkedList or ImmutableList, say.)

      For whatever reason, the Impala FE code exposes ArrayList, HashMap and other implementation choices as variable types and in method signatures.

      This ticket tracks a gradual process of revising the declarations and signatures to use the interfaces List instead of the implementation ArrayList.

      Also, the FE code appears to predate Java 7, so that declarations of lists tend to be in one of two forms (with or without Guava):

      foo1 = new ArrayList<Bar>();
      foo2 = Lists.newArrayList();
      

      Since Java 7, the preferred form is:

      foo = new ArrayList<>();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Paul.Rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: