question about a class person

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...
 
C

Cor Ligthert [MVP]

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
 
G

Guest

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.
 
H

Herfried K. Wagner [MVP]

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).
 
U

ucasesoftware

each contact information object supports setting a role

what is exactly a role ? (some properties) ?
 
H

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top