simple contact manager design

I going to create a very simple contact manager. I dont know which langauge im use yet.

Im just developing my design first.  When I mean simple - like adding, deleting and searching.  

I want to use XML as my storage format - I think XML is the easest/simplest storage format for standalone applications.

My problem is the design - I want it Object Oriented but I dont know what objects to have?

Maybe somebody can advise me what objects should be involved in a simple contact manager - like something that a user can add, delete, search and view contacts details.

I already have a objects - "Person" but after that im not too sure what other objects are involved.

@ellandrd
LVL 16
ellandrdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InteractiveMindCommented:
Person
---------
 - name                 ~String
 - address              ~String
 - email                  ~String
 - ...

AddressBook
---------------
 Load( String )       ~void
 Add( Person )       ~ void
 Delete( Person )    ~ void
 Search( String )    ~ Person []


There's no need to over complicate things. The design I've suggested above uses OO, gives you all of the functionality that you  need, and is also very simple.
ellandrdAuthor Commented:
a thats great start - thank you!
ellandrdAuthor Commented:
what about a gui and the controllers of the address book?
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

InteractiveMindCommented:
Well, you should probably decide on a language prior to getting much further into this. Whilst many think that software design should be generic, it really shouldn't be -- especially if you wish to limit overhead.

Often though, the main class of the application will also be the GUI itself (especially for this type of application).

Furthermore, I'd expect the GUI to deploy and control the address book. You would probably store the AddressBook instance as a global member within your GUI. When the user clicks a button on the GUI, it calls the appropriate methods within the AddressBook.

The output is then caught and displayed.
ellandrdAuthor Commented:
It will be in Java.

So I take it I will have another class for GUI...
ellandrdAuthor Commented:
Im using XML as my storage format too
ellandrdAuthor Commented:
should it be a Contact object or a Person object?

its just im drawing out my UML diagrams...
ellandrdAuthor Commented:
have you came across any case studies on the internet for a OOP related contact manager?

i have not yet and this is why im asking...
InteractiveMindCommented:
Okay. Well, I'd personally probably take on no more than 5 classes:

  Main
  GUI
  Contact
  AddressBook
  XmlLoader

Main initializes GUI. GUI stores an AddressBook instance, which it passes an XmlLoader instance to read the required data from the XML file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ellandrdAuthor Commented:
>>Main initializes GUI. GUI stores an AddressBook instance, which it passes an XmlLoader instance to read the required data from the XML file.

what about Contact class?
InteractiveMindCommented:
AddressBook will handle the Contact class mostly. But this is where you need to decide on exactly how your data is going to be stored ...

Do you want to create an array of Contact classes within AddressBook? Alternatively, do you wish for your data to all stay within the XML file, and you just search it when necessary, and return the required read data in a Contact instance?

The latter would probably be most memory efficient -- however, if your AddressBook isn't going to be very large, then I'd use the first method, of reading ALL entries from the XML file into a Contact array (within the AddressBook class).


>> have you came across any case studies on the internet for a OOP related contact manager?

Not personally, no. Sorry.
ellandrdAuthor Commented:
so far this is my design that im thinking of having - based on your suggestions...

http://www.myjavaserver.com/~seandelaney/uml_design.png

Im not too sure how or where my XML Loader class fits in though?

ellandrd
InteractiveMindCommented:
AddressBook  ->  uses  ->  XmlLoader

By the way, you should have 'Contact' instead of 'Person'; not both.
ellandrdAuthor Commented:
i was having person as a super class?

so:

public class contact extends person
{
}

plus will my data be persisent if i use XML as data storage?  this is gonna be standalone app so using JDBC isnt good choice as users will not have JDBC on there machines...

i want it so it will work anywhere like a applet or something on a windows platform.
InteractiveMindCommented:
> i was having person as a super class?
There's nothing wrong with that, but I wonder why ...

> plus will my data be persisent if i use XML as data storage? ...
Yes, either XML or CSV would be the best choice if you're after portability (and simplicity)  :)
ellandrdAuthor Commented:
but I wonder why.... what?
InteractiveMindCommented:
Why use a 'Person' class in addition to a 'Contact' class. If it's a case that you wish to play about with inheritance, then that's cool. But really, I don't see any real need for both.
ellandrdAuthor Commented:
well some guidelines i have are:

-is application factorised into suitable objects?
-is instance data hidden?
-is design of classes decoupled from another?
-input/output operations encapsulated in a user interface class?
-does design exploit OO relationships to build complex classes hierarchically form similar classess?

so i try to meet these when i build apps...  
ellandrdAuthor Commented:
XMLLoader is a class name in Java, so i cant call my class XMLLoader.java.

What would be a suitable name to call it?
InteractiveMindCommented:
Ah yes, sorry.

XMLDataLoader perhaps. Or, it doesn't even have to have "XML" in it; perhaps AddressBookLoader.
ellandrdAuthor Commented:
to finish up this thread, do you think my design meets my guidelines?
InteractiveMindCommented:
> is instance data hidden?
Make sure that you use data hiding -- such as private, public, and protected modifiers for all of your global variables.

So long as you make sure that you do this, then yes -- your design seems to meet the criteria set.

Good luck.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.