0% found this document useful (0 votes)
8 views10 pages

OOP: Classification, Generalization, Specialization

This instructional module on Object Oriented Programming, developed by Dr. Rogel L. Quilala, covers key concepts such as classification, generalization, and specialization of objects within programming. The course outline includes a structured weekly schedule that introduces Java programming, UML, inheritance, polymorphism, and modularity, culminating in a final exam. Students are expected to engage with the material through assessments, exercises, and self-check tests to reinforce their understanding of the subject matter.

Uploaded by

ularghwenfiona
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

OOP: Classification, Generalization, Specialization

This instructional module on Object Oriented Programming, developed by Dr. Rogel L. Quilala, covers key concepts such as classification, generalization, and specialization of objects within programming. The course outline includes a structured weekly schedule that introduces Java programming, UML, inheritance, polymorphism, and modularity, culminating in a final exam. Students are expected to engage with the material through assessments, exercises, and self-check tests to reinforce their understanding of the subject matter.

Uploaded by

ularghwenfiona
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

INSTRUCTIONAL MODULE AND ITS COMPONENTS

(GUIDE)

COURSE Object Oriented Programming


DEVELOPER AND THEIR Collated by:
BACKGROUND Dr. Rogel L. Quilala
MIT Chairperson
rlquilala@[Link]

COURSE DESCRIPTION The course introduces the students to object-oriented


programming; object-oriented design; encapsulation and
information-hiding; objects and classes, inheritance and
advance inheritance concepts; polymorphism; class
hierarchies; collection classes and modularity.
COURSE OUTLINE Course Content/Subject Matter
Week 1 A. Class Policies, Introduction of
Week 2 OOP,
B. Java programming Language: A
Quick tour a) using primitive data
types b) Object definition and
Object Instantiation
c) Expressions, Statements and
Control-flow Mechanisms d) arrays
Week 3 C. UML and Constructors
Week 4 D. Objects and Classes
Week 5 E. Message, Method, and More Object
Concepts
Week 6 F. Classification, Generalization
Week 7 and Specialization
G. Abstract and Concrete Classes
Week 8 H. Implementation in Java
Week 9 I. Midterm Exam
Week 10 J. Concepts of inheritance, Common
Week 11 Properties
Week 12 K. Implementing Inheritance
L. Code Reuse, Making Changes in
Class Hierarchy
Week 13 M. Concepts of Interface, Inheritance
Week 14 Using Interface
N. Attributes in an Interface, Methods
in an Interface, Abstract Class and
Interface
Week 15 O. Polymorphism
Week 16 P. Modularity
Week 17 Q. Implementation of inheritance and
polymorphism in Java

Classification, Generalization and Specialization 1/10


Week 18 R. Final Exam
One week S. Allotted for the Midterm and the
(or an Final Exams
equivalent
of three
hours)

CHAPTER # 6
TITLE F. Classification, Generalization and Specialization
I. RATIONALE Demonstrate knowledge on objects with similar
definitions that have been grouped and defined into classes.
INSTRUCTION TO THE USERS Lectures are on this module. MS Teams will be used for
showing the actual demonstration of programming using
java.

At the start of the module, you are to take the pre-


assessment test to see
how much information and knowledge you have about the
Classification, Generalization and Specialization

As you go through the lessons, you can read, analyze,


understand the importance of Classification, Generalization
and Specialization

A self-check test, exercises, or other means of assessing will


help you assess how you progress as you go through the
module. The self-check test questions and other activities in
this module will be evaluated by your teacher. These will be
part of your formative evaluation/grade.

Reminder: All answers on your pretest, self-check test and


other activities must be written in separate paper.

DO NOT WRITE IN THE MODULE.

PRE-TEST Direction: Read the questions carefully. Write your


answers on a separate paper.

1. What is classification?
2. What is generalization?
3. What is specialization?

II. LEARNING At the end of the chapter, students are expected to:
OBJECTIVES

Classification, Generalization and Specialization 2/10


• Learn how objects are grouped into classes and
how the relationships of classes can be organized
into a class hierarchy using abstraction mechanisms
generalization and specialization.
• Learn the concept of superclass and subclass as a
prelude to discussing generalization and
specialization.

III. CONTENT

Classification, Generalization and Specialization 3/10


LESSON 1: Classification

Below, there are 18 instances of animal. Each entry has a name and a short descripasftion. Some
of the animals share common information. We will group the animals based on their commonality
with one another.

We begin with Mighty, Flipper, Willy, Janet, Jeremy, Bunny, and Smudge. These objects are
grouped together into the Mammal category because they share some common information typical
of a mammal:

 their young are born alive;


 they are warm-blooded;
 they breathe through their lungs; and
 their bodies are covered with hair.

A list of objects.

Similarly, Parry, Heather, Wise, and Swift are grouped into a Bird category because they share
common information typical of a bird:

 they have a beak;


 they have two legs;
 they have two wings;
 their wings and body are covered with feathers;
 they can fly;
 they lay eggs; and
 they are warm-blooded.

Classification, Generalization and Specialization 4/10


In a like manner, we group:

 Angel and Jaws into a Fish category;


 Sally and Lily into a Reptile category;
 Beatle and Ben into an Insect category; and
 Kermit into an Amphibian category.

Below shows the six categories of animal we have produced so far. In object-oriented modeling,
the act of categorizing objects is known as classification. The categories formed are known as
classes. From a modeling perspective, classes form meaningful abstractions for organizing

information; any reference to the classes would indirectly refer to the objects in the class.

Categories of animal.

Hierarchical Relationship of Classes

Classes formed can be organized in a hierarchical manner. Depending on the position of a class in
the hierarchy, it may be known as a superclass or a subclass of a class. Let us examine the notion
of superclass and subclass here.

Classification, Generalization and Specialization 5/10


Superclass and Subclass

Employee, SalesPerson and Manager classes.

Sean and Sara therefore belong to two classes: the Employee class and SalesPerson class.
Likewise, Simon and Sandy belong to the Employee and Manager class. This implies that the
information about Sean and Sara as employees is also true of them as salespersons. We can thus
refer to Sean as an employee or a salesperson. Which class Sean is referred to is a matter of
generality. When Sean is referred to as an employee, we are being general about who he is but
when he is referred to as a salesperson, specific information about his role and employment is
specified. For example, Sean takes orders and earns a commission for each sale since he is a
salesperson but this does not apply to Sandy who is a manager, despite the fact that both are
employees of HomeCare. Similarly, when we speak of an object as an employee, we are being
general and its differences with objects of other classes are ignored.

The Employee class is said to be a generalized class of SalesPerson and Manager. Conversely,
SalesPerson and Manager are said to be specialized classes of the Employee class. Generalized
and specialized classes can be organized into a class hierarchy with the generalized classes placed
toward the top of the hierarchy and the specialized classes toward the bottom of the hierarchy. A
specialized class is known as a subclass of a class while the generalized class is known as a
superclass of a subclass in object-oriented terms. For example, SalesPerson is a subclass of the
Employee class which is also the superclass of SalesPerson.

A Class Hierarchy Diagram\

The hierarchical relationships among classes can be seen in a class hierarchy diagram below. A
box in the diagram represents a class while a triangle denotes the hierarchical relationship between
classes with a superclass positioned at the top. Subclasses are placed toward the bottom of a class
hierarchy diagram. A class can be a superclass to a class or a subclass of another class or both
depending on its position in the hierarchy.

Classification, Generalization and Specialization 6/10


A class hierarchy diagram.

Manager and SalesPerson are subclasses of the Employee class.

 Employee is a subclass of the Person class.


 Person is a superclass of Customer and Employee class.
 Employee is thus a superclass (to Manager and SalesPerson) and a subclass
(of Person) in the hierarchy.

LESSON 2: Generalization

Generalization is the act of capturing similarities between classes and defining the similarities in a
new generalized class; the classes then become subclasses of the generalized class. For example,
the Mammal, Fish, Bird, Reptile, and Amphibian classes introduced earlier, are similar in that all
objects from these classes have a backbone. Based on this similarity, we can refer to them via a
new superclass, say Animal-with-Backbone. Hence, we can refer to Kermit (an object of the
Amphibian class) as an object of the Animal-with-Backbone class too. Similarly, the Insect class
can be generalized into an Animal-without-Backbone class since objects from the Insert class are
without a backbone. Below summarize the relationships of these classes.

Classification, Generalization and Specialization 7/10


Generalizing classes

The Animal-with-Backbone class and Animal-without-Backbone class can be further generalized


by considering the similarities of objects from these two classes. Let us call the generalized class,
Animal. The generalization of properties of AnimalwithBackbone class and Animal-without-
Backbone class into the Animal class is shown below.
The Animal class, being the topmost class in the class hierarchy, is thus the most general class of
the entire Animal class hierarchy. This means that Swift, which is an object of the Bird class, is
also an object of the Animal-with-Backbone class and Animal class, for example. When we refer
to Swift as an object of the Animal class, we are being general about it and we would be ignoring
specific information about Swift as a bird in this reference.

A class hierarchy for animals.

LESSON 3: Specialization

In contrast, specialization is the act of capturing differences among objects in a class and
creating new distinct subclasses with the differences. In this way, we are specializing information
about objects of the superclass into subclasses. For example, in creating Animal-with-Backbone

Classification, Generalization and Specialization 8/10


class and Animal-without-Backbone class from the Animal class, we are distinguishing
information about objects with a backbone from others without a backbone into Animal-with-
Backbone and Animal-withoutBackbone classes. Eventually, only objects with a backbone would
be classified into the Animal-with-Backbone class and the others into the Animal-without-
Backbone class.

Similarly, objects from the Animal-with-Backbone class can be further classified into the
Mammal, Fish, Bird, Reptile, or Amphibian classes depending on their properties definition.

Organization of Class Hierarchy

Classes in a class hierarchy diagram are organized in such a way that generalized classes are
placed toward the top of the hierarchy. As we traverse higher into a class hierarchy, the classes
become more general in definition and more objects can be classified into them. As we traverse
lower into the class hierarchy, the subclasses become more specialized in definition and fewer
objects can be classified into them.

IV. SYNTHESIS The following concepts were discussed in this chapter:


GENERALIZATION  Classification—categorizing objects into a class.
 A subclass is a specialized class of a superclass, and a
superclass is a generalized class of a subclass.
 Generalization—the act of capturing similarities
between classes and defining the similarities in a new
generalized class; the classes then become subclasses of
the generalized class.
 Specialization—the act of capturing differences among
objects in a class and creating new distinct subclasses with
the differences.
V. EVALUATION

1. In your own words, describe generalization and specialization


2. Information about some objects is given below. Classify the objects into
these classes: Bird, Insect, Fish, and Four-Legged Animal

Classification, Generalization and Specialization 9/10


3. Create generalized classes for the classes in Question 2 and produce a class hierarchy.
VI. ASSIGNMENT 1. What are the objects that can be used in a school?
AGREEMENT Classify the objects in these classes: Employee,
Student, Clerk, Faculty.
2. Create the generalized class for the classes in
Question 1 and produce a class hierarchy.

REFERENCES Object-Oriented Programming and Java


By Danny Poo, Derek Kiong and Swarnalatha Ashok
Second Edition
Joyce Farrell, Java Programming

Classification, Generalization and Specialization 10/10

You might also like