Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Tracey King   on Nov 12 In Java Category.

  
Question Answered By: Zoar Mizrachi   on Nov 12

I see two classes:

- Contact (which containts the name  and the phone  number)
- PhoneBook (a set of contacts)

The relationship between this two classes  is Whole-Part
or Aggregation, also known as the Composite pattern.
You can say "a PhoneBook contains various Contacts,
a Contact is contained in a PhoneBook".

Then you can say that contactName and phoneNumber are
attributes of the Contact class.

And an array, vector or any other structure that holds
various Contact objects can be the attribute of the
PhoneBook class. This class can include also the methods
to mantain the list of contacts: search, insert, delete,
etc.

P.S.: This is just the Analysis Phase, in the Design
Phase you will add more classes, depending on the
language, pattern, etc. you will use.

Share: 

 
 
Didn't find what you were looking for? Find more on help identifying classes Or get search suggestion and latest updates.


Tagged: