M
Maciek Zywno
hello
I am reading "effective java programming" by Josh Bloch and got one
question concerning "applying interfaces as a mean to use constants"
toppic, let's consider a following piece of code:
interface MyConstants{
static final MY_NUMBER = 7;
}
class INeedMyConstantClass implements MyConstants{
//here I can use MY_NUMBER
}
one mistake with such solution is that when class author creates a new
version of a class that no more needs that constant to accomplish its
business method, this class still has to implement the interface to
assure binary compability with a client (hope I properly translated the
sentence into english)
what does binary compability means in this case?
for me client should not bother what interface is implemented because it
refers to an object by means to a class reference and not by an the
interface reference
can you explain this to me?
regards
maciek zywno
I am reading "effective java programming" by Josh Bloch and got one
question concerning "applying interfaces as a mean to use constants"
toppic, let's consider a following piece of code:
interface MyConstants{
static final MY_NUMBER = 7;
}
class INeedMyConstantClass implements MyConstants{
//here I can use MY_NUMBER
}
one mistake with such solution is that when class author creates a new
version of a class that no more needs that constant to accomplish its
business method, this class still has to implement the interface to
assure binary compability with a client (hope I properly translated the
sentence into english)
what does binary compability means in this case?
for me client should not bother what interface is implemented because it
refers to an object by means to a class reference and not by an the
interface reference
can you explain this to me?
regards
maciek zywno