commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [IMAGING] Constant interfaces vs. constant classes
Date Sun, 04 Jan 2015 19:15:21 GMT
+1: Interfaces should be used to define contracts, not constants. I like
using classes to define constants.

Gary

On Sun, Jan 4, 2015 at 1:58 PM, Benedikt Ritter <britter@apache.org> wrote:

> Hi all,
>
> imaging has a lot of constant interfaces and even the
> org.apache.commons.imaging.formats.tiff.constants.AllTagConstants interface
> which combine several interfaces.
>
> I'm in the "no constant interfaces" group. An interface should be used to,
> well, define an interface. Defining interfaces only for the purpose of
> holding constants doesn't really make sense imho. I would like to use
> constant classes instead. Using static imports, the use of constants in the
> code will look the same as before.
> Further more, logic that is currently contained in the TagConstantUtils
> class (for example mergeTagLists, can be moved to the corresponding
> Constant class as private static method, which will also remove it from the
> public API.
>
> I'd like to here what others think about this, since I expect this to be
> partly a question of taste.
>
> Regards,
> Benedikt
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message