Entity Relationship Diagram Modifications

In summary, the conversation discusses the design of a "People" database that includes entities such as Person, Parent, and Child. The main question is whether the relationships between these entities should be based on the "is-a" relationship or the "parent/child of" relationship. It is also mentioned that the context of a person, such as being a parent or a child, may affect the requirements for the Person class. It is suggested to consider using subclasses for different types of people and to also consider including additional information such as adoptive or step parents. Ultimately, the design will depend on the specific context and requirements of the project.
  • #1
twoski
181
2

Homework Statement



Assume you are given the entity Person. This entity has 3 attributes: Name, Name of child, Name of parent.

Now, assume you want to modify your design of ”People” database above to include additional information about types of people such as sex, and people who are parents, etc. Use subclasses of people to represent these special types of people.

The Attempt at a Solution

There are 3 different entity sets we should start with: Person, Child and Parent. Person is the superclass which holds all generic information such as sex, name, age, etc.

Parent and Child should both have the "Is-a" relationship to Person, but we need to also show that a child can be the child of a person, and a parent can be the parent of a person. Should this be introduced as an attribute of the "is-a" relationship? Does one of the relationships take precedent?

We also note that Parents have the "grandparent of" relationship to children.
 
Physics news on Phys.org
  • #2
Remember to solve the problem in "problem space" first. Then solve it in computer space. Does your problem require you to treat a person completely differently if they are a parent, a grand parent, a child, etc.? Or does it require the ability to treat a person differently in different contexts? So in one context a person is a parent, in another a child, in another a grand parent? And what happens if the context wants a parent but the person available has no children? Or if the context wants a grand parent, and the person available has children but no grand children?

Will your Person class include the "has a" for a list of parent persons and another list of child persons? That might make it simpler, but it will depend on the context of the full project. This scheme might have only one type of object, Person. There would not be a separate class for Parent and Child. Whether a Person was a Parent or a Child would depend on whether the appropriate list was empty or populated. You could then construct the family tree implicitly. If you do that then you need to decide if the information about parents and children is contained as pointers in the Person object, or as a separate family tree structure. And what validation rules will exist and be enforced by your database.

Alternatively, the requirements of Person might be very different in context to the requirements of Parent or Child. So the context might tell you that you need a derived class. Maybe there are situations in which you need a Child object but can't use a Person object. Or in which you need a Parent object but cannot use a Person object. This would depend on a lot of context that you may or may not have. Similarly you may need a special class for GrandParent, etc.

Or you may find that it is better to have some kind of data member in the class Person that indicates the jobs a Person object performs. Maybe flags for HasLivingParents, HasLivingChildren, etc. Or possibly NumberLivingParents, NumberChildren, etc.

You might get really fancy and include things like adoptive parents, foster parents, step parents, and so on.

So basically what you need to decide is: Whenever you need an object to describe a child, will a Person object be acceptable? When you need to describe a parent, will a Person object be acceptable? If it will, then make the Person class accommodate the job as a Child or Parent. If not, then make a new class that does the extra job.

Just for completeness, you should even consider the possibility that Child and Parent are not derived from Person. For example, Child-ness might be a bolt-on feature of Person. So Person might "have a" Child-ness. Or Person might "have a" Parent-ness. Or Child and Parent might be completely separate classes with very distinct purposes and behaviour. Again, this depends on the context. I suspect that in most situations involving people you probably don't want to do that. An example might be that your database specifically ignores (maybe for privacy reasons) the possibility that a Child of one Person is the Child of another Person in the database. It sounds very contrived even to me. But as an exercise you should stop and consider it, at least to reject it if it should be rejected.
 
  • #3
The problem statement is exactly as posted... Quite vague and generic.

We are not coding anything based on this, merely designing an ER diagram.

It says we must use subclasses for the different "types" of people, ie. parents and children. So i think based on that we automatically need to have 3 entity sets: Person, Parent and Child. The relationships need to be based on this configuration so my first guess was to use "parent of" and "child of" relationships. Just not sure how that works when there's also applicable "is-a" relationships we can apply.
 

What is an Entity Relationship Diagram (ERD)?

An Entity Relationship Diagram is a visual representation of the relationships between entities (objects or concepts) in a database. It is used to model the data and its structure, helping to identify and organize the different entities and how they are related to each other.

Why would an Entity Relationship Diagram need to be modified?

An ERD may need to be modified for several reasons, such as changes in business rules, modifications to the system or database, or to reflect new relationships between entities. Modifying an ERD can also help to improve its accuracy and efficiency.

What are the steps involved in modifying an Entity Relationship Diagram?

The steps involved in modifying an ERD may vary depending on the specific modifications needed. However, some common steps include identifying the changes needed, making the necessary changes to the diagram, and updating any related documentation. It is also important to review and validate the changes with stakeholders before implementing them.

How do you ensure the accuracy of an Entity Relationship Diagram after modifications?

To ensure the accuracy of an ERD after modifications, it is important to thoroughly review and validate the changes with all stakeholders. This can include checking for any logical errors, verifying the new relationships and attributes, and making sure the diagram accurately reflects the current state of the database or system.

Are there any tools or software that can assist with modifying Entity Relationship Diagrams?

Yes, there are many tools and software available that can assist with modifying ERDs. These tools often have features such as drag-and-drop functionality, automatic relationship detection, and the ability to generate SQL code from the diagram. Some popular tools include Lucidchart, Gliffy, and ER/Studio.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • General Discussion
Replies
11
Views
1K
  • Programming and Computer Science
2
Replies
48
Views
9K
  • Sci-Fi Writing and World Building
3
Replies
96
Views
6K
Replies
1
Views
7K
  • Math Proof Training and Practice
3
Replies
83
Views
10K
  • Sci-Fi Writing and World Building
Replies
7
Views
1K
Replies
10
Views
2K
  • Special and General Relativity
Replies
6
Views
1K
  • Quantum Interpretations and Foundations
Replies
25
Views
1K
Back
Top