Well, I have a system in PHP that allows the management of customers and vendors. In my domain, a customer can be an individual or a legal entity, since a seller may be just an individual.
I implemented this as follows:
Abstract class Entity :
Generalizes all entities.
Abstract class Contact :
Generalizes all contacts (people and companies), having only "contact" attributes, such as: telephone, address, email.
End Class Person :
Specializes in a contact, adding person attributes (name, CPF ...).
Final class Company :
Specializes in a contact, adding company attributes (corporate name, CNPJ ...).
End Class Client :
It has a contact attribute, being a person or company.
End Class Seller :
It has a contact attribute (person).
-
So far, I've come up with the modeling of my OOP system.
I would like to know if it is a good approach or not, and if not, what problems it has and how I can do better.
Thank you in advance!