You are on page 1of 7

ABSTRACT CLASSES

Abstract classes are general classes and are used when generalization/specialization is included in
the design. The general class becomes the abstract class. The abstract class has no direct objects or
class instances, and is only used in conjunction with specialized classes. Abstract classes usually
have attributes and may have a few methods.

why do we even need these?

❑ If you want to design an application/module where you have some standard/common


functionality, which you would like to share in all the child classes; or you want the derived
classes to be free to use and develop the other methods (declared as abstract in parent
class), you need to create an abstract class.

❑ We need to create an abstract class as a base class because it will transmit its default
feature and create a derived class from this abstract base class performing a similar type of
function.
Example
Explanation
Student and Employee are subclasses, because they have different attributes and methods. An
employee does not have a grade point average and a student does not have a salary. This is a simple
version, and does not include employees that are students and students that work for the university.
If these were added, they would be subclasses of the Employee and Student classes. Employee has
two subclasses, Faculty and Administrator, because there are different attributes and methods for
each of these specialized classes.

Subclasses have special verbs to define them. These are often run-on words, using isa for “is a,”
isakinda for “is a kind of,” and canbea for “can be a.” There is no distinction between “is a” and “is
an;” they both use isa.

isa Faculty isa Employee


isakinda Administrator isakinda Employee
canbea Employee canbea Faculty
META DATA
It is a data that describes other data. For example a class definition is a metadata. UML models are also
referred as metadata as they describe the things required for the application. Many real world
applications have metadata such as parts, catalogues, blue-prints and dictionaries.

In above example, car model has a model name, year, base price. A physical car has a serial no, color,
options. A car model describes many physical car and stores common data about them. A car model is
referred as metadata which relates to the data of physical care. A class descriptor object contains
feature and they can have their own classes which are known as meta classes.
CANDIADTE KEY

A candidate key for a class is a combination of one or more attributes that uniquely identifies objects
within a class. The collection of attributes in a candidate key must be minimal; no attribute can be
discarded from the candidate key without destroying uniqueness. No attribute in a candidate key can
be null. A given attribute may participate in multiple candidate keys.

In other words we can say that in a relation, there can be more than one attribute
combination possessing the unique identification property. These combinations, which can
act as primary key, are called candidate keys.

For example, airportCode and airportName are two candidate


Airport keys for Airport. The model specifies that each airportCode
(such as IAH, HOU, STL, ALB) uniquely identifies an airport.
airportCode {MJ 1} Each airportName (such as Houston Intercontinental, Houston
airportName {MJ 2} Hobby, Lambert St. Louis airport, and Albany NY airport) also
uniquely identifies an airport.
CONSTRAINTS
Constraints define the requirements or limitations that must be met over time. They enable the addition of new
rules as well as the modification of current ones. Constraints can exist in any of the three object-oriented analysis
models.

❑ In Object Modelling, the constraints define the relationship between objects. They may also
define the relationship between the different values that an object may take at different times.
❑ In Dynamic Modelling, the constraints define the relationship between the states and events of
different objects.
❑ In Functional Modelling, the constraints define the restrictions on the transformations and
computations
Representation − A constraint is rendered as a string within braces.
Example − The following figure shows a portion of DFD for computing the salary of employees of a
company that has decided to give incentives to all employees of the sales department and increment
the salary of all employees of the HR department. It can be seen that the constraint {Dept:Sales}
causes incentive to be calculated only if the department is sales and the constraint {Dept:HR} causes
increment to be computed only if the department is HR.

You might also like