Okay, that makes sense. I generally try to do that anyway, as far as
return
the interface.
What I don't understand is how you could get around getters and setters
for
something like an int. The only production coding I've done in Java is an
order entry process.
My interpretation of the article was that instead of assuming e.g. "custom
number" is an int, and then storing it as an int throughout your code, you
define e.g.:
public class CustomerNumber extends Integer
{
}
public class Customer
{
public CustomerNumber getCustomerNumber ()
{
}
public void setCustomerNumber (CustomerNumber newNumber)
{
}
}
that way if you always refer to it via the CustomerNumber type, you could
change CustomerNumber to extend from Long or any other class as appropriate
and only need to change it one place. I've never done this in practice but
I can see it makes some amount of sense.
(Yes I realise Integer is final and so you can't extend it... perhaps just
have a public int field inside the CustomerNumber class?)
Nigel Gay,
Computer Patent Annuities.
********************************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee; access to this
email by anyone else is unauthorised.
If you are not the intended recipient: (1) you are kindly requested
to return a copy of this message to the sender indicating that you
have received it in error, and to destroy the received copy; and (2)
any disclosure or distribution of this message, as well as any action
taken or omitted to be taken in reliance on its content, is prohibited
and may be unlawful.
********************************************************************************
As an Amazon Associate we earn from qualifying purchases.