Subject : Computer Science
Paper: Data Structures
Module: Introduction to Abstract Data Types
Module No: CS/DS/1
Quadrant 1 – e-text
Welcome to the e-PG Pathshala Lecture Series on Data Structures. This time we are
going to talk about data structures from a different perspective
Learning Objectives
The learning objectives of the introductory module are as follows:
• To appreciate Programming perspectives
• To understand Programming Design principles
• To know about the different Data Types
• To understand Abstract data types
1.1 Introduction
Though most of you would have studied Data Structures, in this course we will be
looking at Data Structure from a new perspective – the perspective of Abstract Data
Type. Before we understand the concept of abstract data types let us relook at
Programming which is essentially problem solving using a computer system.
However though computers today are used to solve very complex problems –
programming is not magic, the maxim remains that you cannot make a computer do
something if you do not know how to do it yourself. Before you start programming,
you need to understand the problem. Some of the important tips are, find out as
much as you can about the problem by talking to the problem presenter, as far as
possible reuse what has been done before and design the program expecting future
reuse. The first step in understanding the problem is breaking the complex problems
into sub-problems and then trying to determine what previous attempts at solving this
problem or similar problems have succeeded and what attempts have failed and why
they have failed. In order to appreciate the concept of Abstract Data Types we must
first consider some important design principles.
1.2Design Principles
There are some principles that are to be followed when designing a good program.
These include abstraction, encapsulation, modularity and hierarchy. Let us consider
each of the principles one by one.
, 1.2.1 Abstraction
Here are two general definitions of Abstraction.
“Abstraction arises from a recognition of similarities between certain objects,
situations, or processes in the real world, and the decision to concentrate upon those
similarities and to ignore for the time being the differences.” Tony Hoare
“An abstraction denotes the essential characteristics of an object that distinguish it
from all other kinds of objects and thus provide crisply defined conceptual
boundaries, relative to the perspective of the viewer.” Grady Booch
In other words abstraction is also described as the purposeful suppression, or hiding
of some details of a process or an artifact, in order to bring out more clearly other
aspects, details, or structure. In the context of programming the use of Abstract Data
Types (which we will discuss later) or the use of objects encourages abstraction.The
principle of Abstractioncan be described as the process of determining the relevant
and essential properties and features of an entity or what we call an object while
ignoring nonessential details with respect to the way the entity is implemented and
also focuses on obtaining interfaces (outside view) of objects.Moreover relevant
properties are defined by how the entity is to be used and manipulated. For example,
an auto salesperson views a car from the standpoint of its selling features, while a
mechanic views the car from the standpoint of the systems that require maintenance.
1.2.2 Encapsulation
Here are two definitions of Encapsulation.
“Encapsulation is the process of compartmentalizing the elements of an abstraction
that constitute its structure and behavior; encapsulation serves to separate the
contractual interface of an abstraction and its implementation.” Grady Booch
“Encapsulation is a mechanism used to hide the data, internal structure, and
implementation details of an object. All interaction with the object is through a public
interface of operations.” Craig Larman
Encapsulation is a mechanism by which we restrict the access to some of the
object's components, as well as binding the data and methods operating on the data.
The principle of Encapsulation can be described as the separation of objects based
on external and internal aspects. In other words only the external aspects of an
object need to be visible to other objects in the system, while the internal aspects are
details that should not affect other parts of the system and need not be visible to
them. Encapsulation is a technique for packaging the information in such a way as to
hide what should be hidden, and make visible what is intended to be visible that
ishiding implementation details.Hiding the internal aspects of an object essentially
means that they can be changed without requiring changes to other system parts.