G
Guest
I have a Customer table in the database that relates to a CustomerType table
(I have several other table combinations in the database like Document and
DocumentType).
As far as I can tell, I have several ways of defining the Customer class:
1) Use inheritance, where I will have an abstract base class CustomerBase
that other, concrete customer class can subclass, i.e. Private, Company etc.
2) Use composition, so the Customer class would contain a CustomerType
class, exposed as a property.
3) Similar to the second option, but instead of a class, use enum, exposed
too as a property (perhaps instead of an enum, the class would use an int,
just like the Customer table in the db).
What is the right way of defining these type of classes please? I want to be
able
to show instances of them in a grid, or some other type of display, being
able to filter out types that don't belong to the criteria, for example if
the user is looking at the customer list, he would be able to filter rows, by
using a ComboBox for instance.
I'm new to object oriented design and classes, so I'm kinda lost in
situations like these. Any help would be greatly appreciated.
Thank you very much,
Ben
(I have several other table combinations in the database like Document and
DocumentType).
As far as I can tell, I have several ways of defining the Customer class:
1) Use inheritance, where I will have an abstract base class CustomerBase
that other, concrete customer class can subclass, i.e. Private, Company etc.
2) Use composition, so the Customer class would contain a CustomerType
class, exposed as a property.
3) Similar to the second option, but instead of a class, use enum, exposed
too as a property (perhaps instead of an enum, the class would use an int,
just like the Customer table in the db).
What is the right way of defining these type of classes please? I want to be
able
to show instances of them in a grid, or some other type of display, being
able to filter out types that don't belong to the criteria, for example if
the user is looking at the customer list, he would be able to filter rows, by
using a ComboBox for instance.
I'm new to object oriented design and classes, so I'm kinda lost in
situations like these. Any help would be greatly appreciated.
Thank you very much,
Ben