0

I am designing a Object Relational Database and here is my Class Diagram:

http://canning.co.nz/AdvancedDatabase/Class_Diagram.png

My Computer Class has a 1-1 relationship with the CurrentUser Class. When creating the Object in code, the Computer Class has a CurrentUser Object as an attribute (CurrentUser_objtyp).

Here is the code:

create type Computer_objtyp as Object (
CompNo          Number,
CompName    Varchar2(20),
CompOS      Varchar2(20),
CompProcessor   Varchar2(20),
CompRAM     Varchar2(20),
CurrentUser_obj     CurrentUser_objtyp,
HardDriveList_var   HardDriveList_Vartyp,
member function getCompName return varchar2)
/

My question is this:

As the Computer Class has this attribute, does the Computer Class need the attribute listed with the other attributes (CompNo, CompName, CompOS, CompProcessor, CompRAM), or is the relationship link to the CurrentUser Class sufficient?

1 Answers1

0

It all depends on the exact definitions of computer and currentUser. A few examples:

If you perceive a computer as the machine, then does it have no current user, because it needs no user at all. Users belong to the OS.

If you see the current user as the person who has hired computer time on this computer, then is it important.

If you see the current user as the current owner of the computer, then might it be otherwise and could the computer be a feature belonging to the user.

If the current user is an employee of a company and leasing the computer for his work, then is it important to have a link from the computer to the combination company/user, hence could you have a reference to a contract.

You have used a compositional relationship to describe the relationship between the computer and the user. That implies that a computer has a currentuser and that the life span of the current user depends on the life span of the computer. Then should the current user directly or indirectly be part of the list of variables of the computer. On the ohter hand have you also a compositional relationship between a peripherical device and the computer. That is hard to understand. An association is the most likely relationship between a peripherical device and a computer.

Loek Bergman
  • 2,192
  • 20
  • 18