Open Side Menu Go to the Top
Register
final project design final project design

04-18-2013 , 01:49 PM
We are to develop a database to handle records made of several fields much like an address book. The user needs to be able to add/delete a record and modify any field. The user must also be able to search and sort by field or sub-string as well as search and sort a subset of results. The user can choose what fields to be displayed, as well.

That's the gist of the assignment. Our only requirement is that we use a balanced binary tree as our data structure to store records. I think the hardest part of the assignment will be the searching and sorting of records. With that in mind, What do you guys think of my design so for? This flow chart just has the class data variables:

http://img248.imageshack.us/img248/8...ojectflow1.gif

I thought about just making one large class, Record, with all the necessary fields. Would that help me down the road when I develop my search and sort functions?

The class affiliate might need some explanation. Each record/contact may have a field of affiliates, like family member, co-worker etc. A record can have unlimited number of affiliates, therefore in the Record class, I stuck the affiliates in a set.

How could I improve my design? I'd really like to utilize the STL as much as possible but I have very little experience with that library and have only briefly touched on it in class . Any suggestions? I'm at a very early stage in this project and would like to develop this in a professional manner. Thanks!
final project design Quote
04-18-2013 , 03:13 PM
Contact data doesn't really need to be separate from the name class.

The affiliate table should (IMO) be a relationship to other Records. Store just the record ID and relationship name (friend, enemy, lover, etc).
final project design Quote
04-18-2013 , 04:43 PM
Quote:
Originally Posted by Freakin
Contact data doesn't really need to be separate from the name class.
I'm kinda thinking the same and hear what you are saying but if not Contact why Address?
final project design Quote
04-18-2013 , 07:40 PM
Quote:
Originally Posted by Addict_x
I'm kinda thinking the same and hear what you are saying but if not Contact why Address?
With affiliations in scope for this project, it seems quite likely that you'll have multiple members of the same family at the same address. Also, if you were tracking workplace address, then a large number of people could be sharing the same address.

it's fairly common to share an address, but rarely a set of contact data like mobile & email (unless you're a really old couple).
final project design Quote
04-18-2013 , 10:51 PM
Right, that makes sense. Thanks for the input.
final project design Quote
04-21-2013 , 08:32 PM
So, I've started coding my classes and I feel like I'm writing the same elementary low level programs over and over again. I've got my name class and my address class... all will be part of my record class that I will stick in a balanced tree (the only structural requirement). There's got to be a better way...

Do I need all these classes at all? I've started looking into STL map and hash_map...Couldn't I just have a simple struct that has a hash_map, record?

Something like this:
Code:
std::hash_map <std::string, std::string> record;
And then fill it with all the appropriate keys?
Code:
record["ID"] = "";
record["f_name"] = "";
record["m_name"] = "";
record["l_name"] = "";
record["comp_name"] = ""
Would this be better? Am I going to run into a wall trying to get data from a file, search strings and sub-strings, sort...? Or, should I stick with the same ole classes?
final project design Quote

      
m