'. '

Talk:Do Not Expose More Than You Want

From APIDesign

(Difference between revisions)
Jump to: navigation, search

Apidesign (Talk | contribs)
(New page: '''Fixed: f4219513dece''' Regarding "public static final constants": # These are not constants at all if the type is neither primitive nor String. Definitely avoid nonconstant fields, eve...)
Next diff →

Revision as of 05:43, 14 June 2008

Fixed: f4219513dece

Regarding "public static final constants":

  1. These are not constants at all if the type is neither primitive nor String. Definitely avoid nonconstant fields, even if static and final.
    1. Why you think public static final Object CONST_EMPTY = new Object(); is not constant?
  2. True constants can also be problematic because, as mentioned in a previous chapter, the value is inlined into the caller and so cannot ever be changed.
  3. Java 5 enumerations should be encouraged where the value is arbitrary. A constant is appropriate if the value is independently motivated.

--JesseGlick 00:14, 8 April 2008 (UTC)

  1. Page 71: The anecdote about the performance of compiled versus interpreted code is duplicted from a previous chapter. It should exist in one place or the other, but not both.

--TomWheeler Sat Apr 12 19:13:37 CDT 2008

Personal tools
buy