Keys
A way to specify how
entities within a given entity set are distinguished. The values of the
attribute values of an entity must be such that they can uniquely identify the
entity. In other words, no two entities in an entity set are allowed to have exactly
the same value for the attributes.
A key allows us to identify a set of attributes that suffice to distinguish activities from each keys also help uniquely identify relationships, and thus distinguish relationships from each other.
SPECIALIZATION
is the process of maximizing the differences between members of an entity by identifying and distinguishing and unique characteristics (or attributes) of each member.
Specialization is a top-down process. Suppose that we have defined an entity with its attributes. Specialization is the process of defining one or more sub-classes for the superclass and forming superclass / subclass relationships. Each subclass is formed based on some unique or distinguishing attribute or relationships specific to the subclass.
An example of specialization is the creation of the three subclasses for the EMPLOYEE superclass. The three subclasses have many attributes in common. But there are also attributes that are unique to each subclass (like salary and allowances for the fulltime employee). Also there are relationships unique to some classes (like the relationship of PART-TIME employee to Course)
GENERALIZATION
is the process of defining a more general entity type from a set of more specialized entity types. In other words, it is the process of minimizing the differences between the entities by identifying the common features. This is a bottom-up approach, just opposite to the specialization approach. This approach results in the identification of a generalized superclass from the original subclasses.
For example, consider a model where the full time employee, part time employee and consultant are represented as distinct entities. When we apply the generalization process to these entities, we will try to find out the attributes and relationship that are common to all the entities and make a generalized superclass – in this case EMPLOYEE. The distinct entities will be subclasses of the superclass identified through the generalization process.
Both specialization and generalization are valuable techniques for developing superclass/subclass relationships. Whether to use generalization or specialization at a particular time depends on factors like nature of the problem, nature of the entities and relationships and more importantly the personal preference of the person doing the modeling. The best way is to try both the methods and then make a decision by trial and error.