I would say that your professor, Introduction to Information Systems, was right. And your SE professor too (if his lack of comments makes him the opposite). They are entitled depending on your requirements and the domain with which you work. But without any other details, itβs hard for you to model this for you, and I would lean toward what your professor in Europe said. Keep in mind all the fun principles you learned: KISS, DRY, etc., and apply them to your problem.
If the Client
will never have more than one phone number, and no other object in your domain needs a phone number, then a separate Telephone
class is not needed. In the real world, if your requirements are unclear, learn more from your client.
If someone along the way decides that Client
can receive more than one phone number, or another object is entered into your domain that needs a phone number, this is a fairly simple refactoring to do.
So, referring to, say, your Client
had a separate Address
class, which instead included a phone number. Perhaps this Address
class is reused by another class, perhaps Invoice
or Shipment
, where Address
could be used or used in both cases. In this example, you may want Address
( Telephone
) to be its own class.
In your example, Telephone
might be a little far-fetched. You want it to be a separate class for reuse if it had many properties ( AreaCode
, InternationalPrefix
, Number
, etc.), but if Client
just needed a string value called Telephone
, which the user would enter for reference only, then it probably doesn't make sense to be his own class.