, . , , . , , , SRP.
CustomerVO custVO = CustomerDAO.getCustomer(customerID); .
-, , - null, . .
:
bool customerExists = CustomerDAO.exists(customerID);
if (customerExists)
{
CustomerVO custVO = CustomerDAO.getCustomer(customerID);
sendEmail(custVO.getFirstName(), custVO.getEmailID());
}
else
{
// Do whatever is appropriate if there is no such customer.
}
}
, , , , , . , - , (, , does-not-exist-returns-null). , CustomerDAO.getCustomer(customerID) ArgumentException, . , Customer .
, , null. null : " , , ". null , . : " , , , ? GetCustomer , , Customer. null, , , . , , , .