<s>
In	O
the	O
Java	B-Language
programming	I-Language
language	I-Language
,	O
the	O
constant	B-Language
interface	I-Language
pattern	O
describes	O
the	O
use	O
of	O
an	O
interface	B-Language
solely	O
to	O
define	O
constants	O
,	O
and	O
having	O
classes	O
implement	O
that	O
interface	B-Language
in	O
order	O
to	O
achieve	O
convenient	O
syntactic	O
access	O
to	O
those	O
constants	O
.	O
</s>
<s>
However	O
,	O
since	O
constants	O
are	O
very	O
often	O
merely	O
an	O
implementation	O
detail	O
,	O
and	O
the	O
interfaces	O
implemented	O
by	O
a	O
class	O
are	O
part	O
of	O
its	O
exported	O
API	O
,	O
this	O
practice	O
amounts	O
to	O
putting	O
implementations	O
details	O
into	O
the	O
API	O
,	O
which	O
was	O
considered	O
inappropriate	O
by	O
,	O
e.g.	O
,	O
Java	B-Language
designer	O
Joshua	O
Bloch	O
.	O
</s>
<s>
In	O
general	O
,	O
collecting	O
system	O
constants	O
into	O
classes	O
independent	O
of	O
behaviour	O
might	O
create	O
a	O
poor	O
object-oriented	B-Language
design	O
because	O
it	O
is	O
often	O
a	O
sign	O
of	O
low	O
cohesion	O
.	O
</s>
<s>
For	O
these	O
reasons	O
,	O
constant	B-Language
interfaces	I-Language
may	O
be	O
considered	O
an	O
anti-pattern	O
.	O
</s>
<s>
Contrary	O
to	O
the	O
compile-time	B-Application
tactical	O
utility	O
of	O
implementing	O
a	O
constant	B-Language
interface	I-Language
,	O
the	O
incidental	O
run-time	B-Library
artifacts	O
have	O
little	O
practical	O
purpose	O
(	O
cf	O
.	O
</s>
<s>
marker	B-Language
interfaces	I-Language
which	O
also	O
have	O
no	O
methods	O
but	O
are	O
useful	O
at	O
run-time	B-Library
)	O
.	O
</s>
<s>
If	O
binary	B-General_Concept
code	I-General_Concept
compatibility	I-General_Concept
is	O
required	O
in	O
future	O
releases	O
,	O
the	O
constant	B-Language
interface	I-Language
must	O
remain	O
forever	O
an	O
interface	B-Language
(	O
it	O
cannot	O
be	O
converted	O
into	O
a	O
class	O
)	O
,	O
even	O
though	O
it	O
has	O
not	O
been	O
used	O
as	O
an	O
interface	B-Language
in	O
the	O
conventional	O
sense	O
.	O
</s>
<s>
Without	O
an	O
IDE	O
that	O
resolves	O
where	O
the	O
constant	O
are	O
coming	O
from	O
,	O
tracking	O
it	O
back	O
to	O
its	O
containing	O
class	O
or	O
interface	B-Language
can	O
be	O
time	O
consuming	O
.	O
</s>
<s>
An	O
instance	O
of	O
the	O
interface	B-Language
is	O
syntactically	O
no	O
more	O
useful	O
than	O
the	O
interface	B-Language
name	O
itself	O
(	O
since	O
it	O
has	O
no	O
methods	O
)	O
.	O
</s>
<s>
Note	O
that	O
the	O
Java	B-Language
libraries	O
use	O
constant	B-Language
interface	I-Language
pattern	O
themselves	O
,	O
showing	O
that	O
it	O
may	O
be	O
a	O
reasonable	O
choice	O
in	O
some	O
situations	O
.	O
</s>
<s>
Many	O
of	O
the	O
pitfalls	O
of	O
the	O
anti-pattern	O
can	O
be	O
avoided	O
by	O
converting	O
the	O
constant	B-Language
interface	I-Language
to	O
a	O
class	O
with	O
static	O
attributes	O
:	O
</s>
<s>
Since	O
Java	B-Language
5	O
,	O
one	O
can	O
use	O
static	B-Language
import	I-Language
to	O
be	O
able	O
to	O
use	O
the	O
constants	O
without	O
the	O
Constants	O
qualifier	O
:	O
</s>
<s>
This	O
achieves	O
the	O
same	O
goals	O
as	O
using	O
an	O
interface	B-Language
,	O
allowing	O
the	O
constants	O
to	O
be	O
referenced	O
without	O
a	O
qualifier	O
.	O
</s>
<s>
Because	O
static	O
members	O
can	O
be	O
imported	O
specifically	O
,	O
the	O
class	O
namespace	O
need	O
not	O
be	O
polluted	O
with	O
all	O
members	O
of	O
the	O
constant	B-Language
interface	I-Language
.	O
</s>
<s>
Run-time	B-Library
and	O
compile-time	B-Application
semantics	O
are	O
more	O
closely	O
aligned	O
when	O
using	O
static	B-Language
imports	I-Language
instead	O
of	O
constant	B-Language
interfaces	I-Language
.	O
</s>
<s>
The	O
compiled	O
code	O
has	O
one	O
fewer	O
binary	B-General_Concept
compatibility	I-General_Concept
constraint	O
(	O
that	O
"	O
class	O
Calculations	O
implements	B-Language
Constants	O
"	O
)	O
.	O
</s>
<s>
Because	O
static	B-Language
imports	I-Language
apply	O
only	O
to	O
the	O
current	O
file	O
(	O
and	O
not	O
the	O
whole	O
class	O
hierarchy	O
)	O
it	O
is	O
easier	O
to	O
discover	O
where	O
each	O
static	O
member	O
is	O
declared	O
.	O
</s>
<s>
There	O
is	O
less	O
need	O
to	O
declare	O
variables	O
of	O
the	O
constant	B-Language
interface	I-Language
type	O
,	O
and	O
it	O
is	O
potentially	O
clearer	O
that	O
no	O
concrete	O
instance	O
actually	O
exists	O
.	O
</s>
<s>
Note	O
,	O
however	O
,	O
that	O
the	O
changes	O
do	O
nothing	O
to	O
improve	O
the	O
cohesion	O
of	O
the	O
Constants	O
class	O
nor	O
prevent	O
the	O
accidental	O
silent	O
modification	O
of	O
the	O
value	O
of	O
a	O
constant	O
,	O
so	O
static	B-Language
imports	I-Language
should	O
not	O
be	O
considered	O
to	O
be	O
a	O
panacea	O
.	O
</s>
