question about a class person

  • Thread starter Thread starter ucasesoftware
  • Start date Start date
U

ucasesoftware

If u have a class person, do u add a property adress, phoneNumber in
this class or is it better to add for exemple a class home with in
adress, phoneNumber, etc...
 
Usecase,

Just as you want.

You can create a collection of phonenumbers or you can set them side by
side. If it is for a database, than I will opt probably for side by side
(just because that is easier to maintenance) although I am in doubt with the
growing type of types of phonenumbers.

If it is in a class than I will sure make a collection from it with in that
a class the properties

Type of phonenumber
phonenumber

Cor
 
This depends on your applcication's uses of the class. If it is a simple
address book then probably yes. If you are coding the game "The Sims" then
probably no.
 
ucasesoftware said:
If u have a class person, do u add a property adress, phoneNumber in
this class or is it better to add for exemple a class home with in
adress, phoneNumber, etc...

As others have mentioned, this depends on the circumstances. Maybe it's
better to support multiple addresses per person (for example in a property
of a collection type which supports adding and removing contact details),
and each contact information object supports setting a role (home address,
work address, secondary home address, or similar).
 
each contact information object supports setting a role

what is exactly a role ? (some properties) ?
 
ucasesoftware said:
what is exactly a role ? (some properties) ?

Yes, a property, either of an enumeration or of another type like string or
certain classes if the range is not known at compile time.
 
Back
Top