I am trying to apply some OOP principles to some C Abstract Data Type model. Given a ADT that abstract a Employee, where a Employee instance is inmutable (when instancing a Employee it gives a unique primary key Name and Last Name and this primary key keeps inmutable during the Employee object life) i wonder if this ADT should care about saving his data in the Database.
So given this piece of code of the ADT:
static char* address; //Address of the Employee
TakeNewAddress(char* newaddress)
{
.....
}
GiveAddress(char* address)
{
....
}
Should SetAddress method copy the content of newaddress into his address attribute and save it into Database or should it only update his address attribute? Should GiveAddress return address variable or should it retrieve it from the database?
I think this ADT representing a Employee should not care about internal database (it is not something you ask to a employee), so saving his data into the Database should be performed outside this ADT by a special handler or user interface for the system.