0% found this document useful (0 votes)
17 views

Sw Chapter One

Uploaded by

biqookoo906
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)
17 views

Sw Chapter One

Uploaded by

biqookoo906
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
You are on page 1/ 27

Chapter One

Introduction to Software Engineering

1.1. Software and Software Engineering


The software has become critical to advancement in almost all areas of human endeavor. The art
of programming is no longer enough to construct large programs. There are serious problems
with the cost, timeliness, maintenance, and quality of many software products. Software
engineering aims to solve these problems by producing good quality software that is in budget
and maintained on time
The term Software Engineering consists of two words, “Software” and “Engineering.”
Software is more than just a program code. A program is an executable code, which serves some
computational purpose. Software is considered to be collection of executable programming code,
associated libraries and documentations.
Generally,
1. A program is a set of instructions that are given to a computer in order to achieve a specific
task whereas software is when a program is made available for commercial business and is
properly documented along with its licensing. Software=Program+documentation+licensing.
2. A program is one of the stages involved in the development of the software, whereas a
software development usually follows a life cycle, which involves the feasibility study of the
project, requirement gathering, development of a prototype, system design, coding, and
testing.
Some essential characteristics of software are given below:-
 Software has logical properties rather than physical
Software has no physical shape, no volume, no colour, and no odour but s/w products can be
measured, estimated and their performance can be calculated.
• Software is produced in an engineering manner rather than in a classical manner:
The engineering mechanism provides some organized activities or tasks with their defined
approaches for software production.
• Software is mobile to change:
Functionality can be modified, platform can be changed, new features can be incorporated,
and software can further be migrated onto different platform

1|Page
• The software becomes obsolete but does not wear out
Software becomes obsolete due to increasing requirements of the users and rapidly changing
technologies and do not wear out as they do not have any physical properties.

• Software has certain operating environment, end user, and customer:


Some software products are platform independent while others are platform specific.

Software, when made for a specific requirement is called software product. Engineering on the
other hand, is all about developing products, using well-defined, scientific principles and
methods.

Software engineering is an engineering branch associated with development of software


product using well-defined scientific principles, methods and procedures. It is also defined as a
process of analyzing user requirements and then designing, building, and testing software
application which will satisfy those requirements development, operation and maintenance of
software; that is, the application of engineering to software. The outcome of software
engineering is an efficient and reliable software product. In other words, it is the application of a
systematic, disciplined, quantifiable approach to the

1.1.1. Objectives of Software Engineering


The characteristics of any software product include features which are displayed by the product
when it is installed and put in use. They are not the services which are provided by the product,

2|Page
instead, they have related to the products dynamic behavior and the use made of the product,
some of them the attributes of software products are listed below.

1. Maintainability –
It should be feasible for the software to evolve to meet changing requirements.
2. Efficiency
The software should not make wasteful use of computing devices such as memory,
processor cycles, etc.
3. Correctness
A software product is correct if the different requirements as specified in the SRS
document have been correctly implemented.
4. Reusability
A software product has good reusability if the different modules of the product can easily
be reused to develop new products.
5. Testability
Here software facilitates both the establishment of test criteria and the evaluation of the
software with respect to those criteria.
6. Reliability
It is an attribute of software quality. The extent to which a program can be expected to
perform its desired function, over an arbitrary time period.
7. Portability
In this case, the software can be transferred from one computer system or environment to
another.
8. Adaptability
In this case, the software allows differing system constraints and the user needs to be
satisfied by making changes to the software
1.1.2. Software Engineering Development Activities
In this section, we give an overview of the technical activities associated with object-oriented
software engineering. Development activities deal with the complexity by constructing and
validating models of the application domain or the system.
Development activities include:-

3|Page
 Requirements Elicitation
 Analysis
 System Design
 Object Design
 Implementation
 Testing
Requirements Elicitation
During requirements elicitation, the client and developers define the purpose of the system. The
result of this activity is a description of the system in terms of actors and use cases. Actors
represent the external entities that interact with the system. Actors include roles such as end
users, other computers the system needs to deal with (e.g., a central bank computer, a network),
and the environment (e.g., a chemical process). Use cases are general sequences of events that
describe all the possible actions between an actor and the system for a given piece of
functionality.
Analysis
During analysis, developers aim to produce a model of the system that is correct,
complete,consistent, and unambiguous. Developers transform the use cases produced during
requirements elicitation into an object model that completely describes the system. During this
activity, developers discover ambiguities and inconsistencies in the use case model that they
resolve with the client.
System Design
During system design, developers define the design goals of the project and decompose the
system into smaller subsystems that can be realized by individual teams. Developers also select
strategies for building the system, such as the hardware/software platform on which the system
will run, the persistent data management strategy, the global control flow, the access control
policy, and the handling of boundary conditions. The result of system design is a clear
description of each of these strategies, a subsystem decomposition, and a deployment diagram
representing the hardware/software mapping of the system. Whereas both analysis and system
design produce models of the system under construction, only analysis deals with entities that the
client can understand. System design deals with a much more refined model that includes many
entities that are beyond the comprehension (and interest) of the client.

4|Page
Object Design
During object design, developers define solution domain objects to bridge the gap between the
analysis model and the hardware/software platform defined during system design. This includes
precisely describing object and subsystem interfaces, selecting off-the-shelf components,
restructuring the object model to attain design goals such as extensibility or
understandability,and optimizing the object model for performance. The result of the object
design activity is a detailed object model annotated with constraints and precise descriptions for
each element.
Implementation
During implementation, developers translate the solution domain model into source code. This
includes implementing the attributes and methods of each object and integrating all the objects
such that they function as a single system.

5|Page
Testing
During testing, developers find differences between the system and its models by executing the
system (or parts of it) with sample input data sets. During unit testing, developers compare the
object design model with each object and subsystem. During integration testing, combinations of
subsystems are integrated together and compared with the system design model. During system
testing, typical and exception cases are run through the system and compared with the
requirements model. The goal of testing is to discover as many faults as possible such that they
can be repaired before the delivery of the system. The planning of test phases occurs in parallel
to the other development activities: System tests are planned during requirements elicitation and
analysis, integration tests are planned during system design, and unit tests are planned during
object design.
1.1.3. Software Evolution
The process of developing a software product using software engineering principles and methods
is referred to as software evolution. This includes the initial development of software and its
maintenance and updates, till desired software product is developed, which satisfies the expected
requirements.

Evolution starts from the requirement gathering process. After which developers create a
prototype of the intended software and show it to the users to get their feedback at the early
stage of software product development. The users suggest changes, on which several
consecutive updates and maintenance keep on changing too. This process changes to the
original software, till the desired software is accomplished.

6|Page
Even after the user has desired software in hand, the advancing technology and the changing
requirements force the software product to change accordingly. Re-creating software from
scratch and to go one-on-one with requirement is not feasible. The only feasible and economical
solution is to update the existing software so that it matches the latest requirements

1.1.4. Classification of software


The software has become an integral part in most of the fields of human life.

1) System software – This type of software that manages and controls the internal functions of a
computer system. It is a set of programs that provide service to other programs to use it
effectively, for example, drivers, compilers, operating systems, etc.
2) Embedded software – This type of software is placed in the “Read-only memory (ROM)” of
the product and controls the various functions of the product. The outcome could be an aircraft,
automobile, security system, signaling system, the control unit of power plants, etc. Embedded
software supervises hardware components. It is also known as intelligent software.
3) Business Software – This type of software is widely used in areas where managerial and
control of financial activities has the highest priority. The main component of a business system
is payroll, inventory, and accounting software, which allows the user to access relevant data from
the database. These activities usually operated with the help of particular business software,
which provides an efficient framework in business operations and management decisions.
4) Personal computer software – This software is used for official and personal use. The PC
software market has grown over the past two decades, from the simple text editor to the standard
word processor. This software is used mostly in almost every field, whether it is a database

7|Page
management system, financial accounting package, or multimedia-based software. It turned out
to be a versatile tool for routine applications.
5) Real time software – This type of software observes, analyzes, and controls real-world events
as they occur. In general, a real-time system ensures a response to an external event within a
defined period. An example of real-time software is the weather forecasting software that
collects and processes parameters such as temperature and humidity of the outdoor environment
to forecast the weather. Mostly defense organizations worldwide use real-time software to
control their military hardware.
6) Artificial intelligence software – This type of software is used when the problem-solving
technique is not algorithmic. Solutions to such problems generally do not agree with simple
calculations or analyzes. Instead, these problems require specific troubleshooting strategies,
which include expert systems, pattern recognition, etc. In addition, these are different types of
research techniques that include the use of heuristics. The role of artificial intelligence software
is to add certain degrees of intelligence to mechanical hardware to get the job done quickly.
7) Web-based software – This type of software serves as an interface between the user and the
internet. Data on the internet is in the form of a text, audio, or video format linked to hyperlinks.
The web browser is software that retrieves web pages. The software incorporates operating
instructions written in specialized scripting languages such as CGI or ASP. In addition to provide
Internet browsing, this software also supports other useful features when browsing the Internet.
8) Engineering and scientific software – This kind of software has emerged as a powerful tool
for research and development of the next generation of technology. This software is designed to
make accurate calculations of complex numerical data obtained in a real-time environment.
1.1.5. Two Orthogonal view of software.
In software engineering, a system is considered orthogonal if changing one of its components
changes the state of that component only. For instance, consider a program with three variables:
a, b, and c. Changing the value of a should not change the value of b or c, provided they are
independent.
See the following quote from Eric S. Raymond’s “Art of UNIX programming”:

Orthogonality is one of the most important properties that can help make even complex
designs compact. In a purely orthogonal design, operations do not have side effects; each
action (whether it’s an API call, a macro invocation, or a language operation) changes

8|Page
just one thing without affecting others. There is one and only one way to change each
property of whatever system you are controlling

Orthogonality is a software design principle for writing components in a way that changing one
component doesn’t affect other components. It is the combination of two other principles,
namely strong cohesion and loose coupling.
It's actually is a term borrowed from mathematics. For example, two lines are orthogonal if they
are perpendicular. In software design, two components are orthogonal if a change in one does not
affect the other.
Applying this concept to classes or other sections of code results in less coupling. To be
orthogonal two classes cannot depend on each others implementation. Changing the internals of
one class does not affect the other class. Components should be independent and have only a
single responsibility.
Consider a method that reads a list of numbers from a file and returns them in sorted order. Now
the requirements change and the numbers are in a database. Modifying this method to access the
database would cause client code to change. If this were two different methods, then a new
source would not affect the sorting method. Only the client code would have to know the source
of the numbers.
In Software Engineering there are two orthogonal views, traditional approach and object oriented
approach. The primary focus of traditonal approach is functions of the system ( procedures) ,
what it is going ? , where as the primary concern for an object oriented approach is both objects
and data.

Object oriented systems are:-


Easier to adapt to changes

9|Page
More robust
Easier to maintain
Promote greater design and code reuse
Creates modules of functionality

1.2. Software development process models


1.2.1. Software life cycle and process models
Software Processes is a coherent set of activities for specifying, designing, implementing and
testing software systems. A software process model is an abstract representation of a process that
presents a description of a process from some particular perspective. There are many different
software processes but all involve:
 Specification – defining what the system should do;
 Design and implementation – defining the organization of the system and implementing
the system;
 Validation – checking that it does what the customer wants;
 Evolution – changing the system in response to changing customer needs.

SDLC stands for the Software Development life cycle. It is a pictorial and diagrammatic

representation of the software life cycle. A life cycle model represents all the techniques required

to integrate software into the program. It also provides the framework in which these methods

should be performed.

In other words, visual representations of the geographical life of various activities are performed

on a computer system from inception to retirement. Different life cycles may determine

appropriate developmental activities in different areas in different ways. Therefore, no element

follows the model of life, essential activities are included in life, although the activity may be

performed in different directions in different living standards. During any life cycle, more than

one activity can also be performed.

10 | P a g e
SDLC is a process that is used to develop software. The goal of the SDLC is to produce high-

quality software that fulfills customer expectations. Software development should be completed

within a specified time and cost.

There are some reasons why SDLC is essential for developing software: -

1. SDLC helps to analyze the requirements and cost estimation for developing software.

2. It makes all the process systematically for the developers.

3. It gives an idea about what to do and when to do it.

4. It reduces the chances of product failure.

1.2.1.1. SDLC Phases

1) Planning and Requirement analysis


The planning phase reflects the objectives of the project, which were collected during the
requirement gathering phase. It involves identifying the specific activities and resources required
to complete the project and planning the steps required to accomplish those objectives.
Requirement analysis is the most important step in the software development life cycle. A
business analyst collects the requirements from the customer. The customer’s requirements are
documented in the Business Requirement Specification.
For Example, A customer wants to have an application which involves money transactions. In
this case, the requirement has to be clear like what kind of transactions will be done, how it will
be done, in which currency it will be done, etc.

11 | P a g e
2) Feasibility study
In this stage, the project team will want to answer some key questions at this point. For example
can the project be completed on time, and it can be completed within the existing budget that it’s
been set aside for this particular project. Also, with the existing staff you have. The expertise in
house to do this kind of project or you had to hire outer contractors. If you have the expertise in-
house, it is a custom type of software. Do you go ahead and build that with internal staff, or is
there an existing software package that you could buy yourself that meets your needs.
3) Design
The next step is to bring complete knowledge of requirements and analysis and to design a
software product. The information gathered from users are inputs of this phase.
4) Coding
In this phase of the SDLC, real development begins, and programming is done. Implementation
of software design begins in the context of writing code in the appropriate programming
language and efficiently developing error-free executable programs.

12 | P a g e
5) Testing
When software is developed, it is tested against the requirements of the software to meet the
requirements, which are mentioned during the requirements phase. Developers do software
testing while coding, and experts also do it at different levels, such as module testing, program
testing, product testing, in-house testing, and user end-of-product testing.
6) Deployment
The deployment phase aims to make the developed software operational in a live environment.
When the product is fully tested and accepted by the business, then it is deployed in the
operational environment.
7) Maintenance
The software is maintained by updating the code according to changes in the user’s environment
or technology over time. At this stage, challenges may arise from hidden bugs and unknown real-
world problems.
1.2.1.2. Software Development Life Cycle Models
1.3.Waterfall Model
The waterfall model is a breakdown of project activities into linear sequential phases, where each
phase depends on the deliverables of the previous one and corresponds to a specialization of
tasks. In this model, the outcome of one phase is the input for the next phase. Development of
the next phase starts only when the previous phase is complete.

 First, Requirement gathering and analysis is done. Once the requirement is freeze then
only the System Design can start. Herein, the SRS document created is the output for the
Requirement phase and it acts as an input for the System Design.
 In System Design Software architecture and Design, documents which act as an input for
the next phase are created i.e. Implementation and coding.
 In the Implementation phase, coding is done and the software developed is the input for
the next phase i.e. testing.
 In the testing phase, the developed code is tested thoroughly to detect the defects in the
software. Defects are logged into the defect tracking tool and are retested once fixed. Bug
logging, Retest, Regression testing goes on until the time the software is in go-live state.

13 | P a g e
 In the Deployment phase, the developed code is moved into production after the sign off
is given by the customer.
 Any issues in the production environment are resolved by the developers which come
under maintenance.

Advantages of using Waterfall model :


 Simple and easy to understand and use.
 For smaller projects, waterfall model works well and yield the appropriate results.
 Since the phases are rigid and precise, one phase is done one at a time, it is easy to
maintain
 The entry and exit criteria are well defined, so it easy and systematic to proceed
with quality. Results are well documented.
Disadvantages of using Waterfall model:
 Cannot adopt the changes in requirements
 It becomes very difficult to move back to the phase. For example, if the
application has now moved to the testing stage and there is a change in
requirement, It becomes difficult to go back and change it.
 Delivery of the final product is late as there is no prototype which is demonstrated
intermediately.
 For bigger and complex projects, this model is not good as a risk factor is higher.
 Not suitable for the projects where requirements are changed frequently.
 Does not work for long and ongoing projects.

14 | P a g e
 Since the testing is done at a later stage, it does not allow identifying the
challenges and risks in the earlier phase so the risk mitigation strategy is difficult
to prepare.
1.4.V Model
The V-model represents a development process that may be considered an extension of the
waterfall model. Instead of moving down in a linear way, the process steps are bent upwards
after the coding phase, to form the typical V shape. The V-Model demonstrates the relationships
between each phase of the development life cycle and its associated phase of testing. V- Model is
also known as Verification and Validation Model. In this model Verification & Validation goes
hand in hand i.e. development and testing goes parallel. V model and waterfall model are the
same except that the test planning and testing start at an early stage in V-Model

Advantages of V-model

 Simple and easy to use.


 Testing activities like planning, test designing happens well before coding. This
saves a lot of time. Hence higher chance of success over the waterfall model.
 Proactive defect tracking – that is defects are found at early stage.
 Avoids the downward flow of the defects.
 Works well for small projects where requirements are easily understood.

15 | P a g e
Disadvantages of V-model

 Very rigid and least flexible.


 Software is developed during the implementation phase, so no early prototypes
of the software are produced.
 If any changes happen in midway, then the test documents along with
requirement documents has to be updated.

1.5. Incremental Model


The incremental build model is a method of software development where the model is designed,
implemented and tested incrementally (a little more is added each time) until the product is
finished. It involves both development and maintenance. The product is defined as finished when
it satisfies all of its requirements. Each iteration passes through the requirements, design, coding
and testing phases. And each subsequent release of the system adds function to the previous
release until all designed functionally has been implemented. This model combines the elements
of the waterfall model with the iterative philosophy of prototyping.

Advantage of Incremental Model


o Errors are easy to be recognized.
o Easier to test and debug
o More flexible.
o Simple to manage risk because it handled during its iteration.
o The Client gets important functionality early.

16 | P a g e
Disadvantage of Incremental Model
o Need for good planning
o Total Cost is high.
o Well defined module interfaces are needed.

1.6. Prototype Model


Software prototyping refers to the creation of software application prototypes that show the
functionality of the product being developed, but that does not have the exact logic of the
original software.
The prototype model is a model in which the prototype is developed prior to the actual software.
The prototype creation model is a method of developing the software in which a prototype of
software or app is constructed, tested, and then reworked as needed until an acceptable result is
obtained from which the complete software or product can be developed. This model works best
in scenarios where not all project requirements are known in detail in advance. It is an iterative
trial and error process that takes place between developers and users. Prototype models have
limited functional capabilities and inefficient performance when compared to the actual software.
Dummy functions are used to create prototypes. This is a valuable mechanism for understanding
the customers’ needs. Software prototypes are built prior to the actual software to get valuable
feedback from the customer. Feedbacks are implemented and the prototype is again reviewed by
the customer for any change. This process goes on until the model is accepted by the customer.

Once the requirement gathering is done, the quick design is created and the prototype which is
presented to the customer for evaluation is built. Customer feedback and the refined requirement
is used to modify the prototype and is again presented to the customer for evaluation. Once the
customer approves the prototype, it is used as a requirement for building the actual software. The
actual software is build using the Waterfall model approach.

17 | P a g e
Advantages of Prototype Model:
 Prototype model reduces the cost and time of development as the defects are found much
earlier.
 Missing feature or functionality or a change in requirement can be identified in the
evaluation phase and can be implemented in the refined prototype.
 Involvement of a customer from the initial stage reduces any confusion in the
requirement or understanding of any functionality.
Disadvantages of Prototype Model:
 Since the customer is involved in every phase, the customer can change the requirement
of the end product which increases the complexity of the scope and may increase the
delivery time of the product.
1.7. Iterative Model
An iterative life cycle model does not attempt to start with a full specification of requirements by
first focusing on an initial, simplified set user features, which then progressively gains more
complexity and a broader set of features until the targeted system is complete. When adopting
the iterative approach, the philosophy of incremental development will also often be used
liberally and interchangeably.
This model consists of the same phases as the waterfall model, but with fewer restrictions.
Generally, the phases occur in the same order as in the waterfall model, but these may be
conducted in several cycles. A reusable product is released at the end of the cycle, with each
release providing additional functionality.
In other words, the iterative approach begins by specifying and implementing just part of the
software, which can then be reviewed and prioritized in order to identify further requirements.
This iterative process is then repeated by delivering a new version of the software for each
iteration. In a light-weight iterative project the code may represent the major source of
documentation of the system; however, in a critical iterative project a formal software
specification may also be required.
For example:

18 | P a g e
In the diagram above when we work iteratively we create rough product or product piece in one
iteration, then review it and improve it in next iteration and so on until it’s finished. As shown in
the image above, in the first iteration the whole painting is sketched roughly, then in the second
iteration colors are filled and in the third iteration finishing is done. Hence, in iterative model the
whole product is developed step by step.
Advantages of Iterative Model
1. Many features can be developed quickly in the life cycle.
2. Results are received quickly and periodically.
3. Testing and debugging is easy during short iterations.
4. Less expensive to change scope / requirements.
5. Suitable for large projects.
Disadvantages of Iterative Model
1. Requires more management attention.
2. Risk analysis requires highly efficient resources.
3. The project completion date has not been confirmed due to changing requirements.

1.8.Spiral model
The spiral model, first described by Barry Boehm in 1986, is a risk-driven software development
process model which was introduced for dealing with the shortcomings in the traditional
waterfall model. A spiral model looks like a spiral with many loops. The exact number of loops
of the spiral is unknown and can vary from project to project. This model supports risk handling,

19 | P a g e
and the project is delivered in loops. Each loop of the spiral is called a Phase of the software
development process.
The initial phase of the spiral model in the early stages of Waterfall Life Cycle that is needed to
develop a software product. The exact number of phases needed to develop the product can be
varied by the project manager depending upon the project risks. As the project manager
dynamically determines the number of phases, so the project manager has an important role to
develop a product using a spiral model.

1.8.1.1. Software Metrics

A software metric is a measure of software characteristics which are measurable or countable.


Software metrics are valuable for many reasons, including measuring software performance,
planning work items, measuring productivity, and many other uses.

Within the software development process, many metrics are that are all connected. Software
metrics are similar to the four functions of management: Planning, Organization, Control, or
Improvement.
Software metrics can be classified into two types as follows:
1. Product Metrics: These are the measures of various characteristics of the software product.
The two important software characteristics are:
1. Size and complexity of software.

20 | P a g e
2. Quality and reliability of software.
These metrics can be computed for different stages of SDLC.
2. Process Metrics: These are the measures of various characteristics of the software
development process. For example, the efficiency of fault detection. They are used to measure
the characteristics of methods, techniques, and tools that are used for developing software.
1.9. Object oriented system development methodology

Object oriented development offers a diffrenet model from the traditional software development
approach, which is based on functions and procedures. In simplify terms, object oriented
software development is a way to develop a software by building self contained modules or
objects that can be easily replaced, modified and reused.

In object oriented system environment every thing is considered as an object and each object is
responsible for itself. For example, every windows application needs windows objects that can
open themselves on the screen and either display something or accept input.

In the object-oriented design method, the system is viewed as a collection of objects (i.e.,
entities). The state is distributed among the objects, and each object handles its state data. For
example, in a Library Automation Software, each library representative may be a separate
object with its data and functions to operate on these data. The tasks defined for one purpose
cannot refer or change data of other objects. Objects have their internal data which represent
their state. Similar objects create a class. In other words, each object is a member of some class.
Classes may inherit features from the superclass.

21 | P a g e
Terms related to object design are:-

1. Objects: All entities involved in the solution design are known as object.
An object is a real-world element in an object–oriented environment that may have a
physical or a conceptual existence. Each object has –
o Identity that distinguishes it from other objects in the system.
o State that determines the characteristic properties of an object as well as the
values of the properties that the object holds.
o Behavior that represents externally visible activities performed by an object in
terms of changes in its state.
o Objects can be modelled according to the needs of the application. An object may
have a physical existence, like a customer, a car, etc.; or an intangible conceptual
existence, like a project, a process, etc.
2. Classes: A class is a generalized description of an object. An object is an instance of a class.
A class defines all the attributes, which an object can have and methods, which represents the
functionality of the object.
A class represents a collection of objects having same characteristic properties that exhibit
common behavior. It gives the blueprint or description of the objects that can be created from

22 | P a g e
it. Creation of an object as a member of a class is called instantiation. Thus, object is an
instance of a class.
The constituents of a class are −
 A set of attributes for the objects that are to be instantiated from the class.
Generally, different objects of a class have some difference in the values
of the attributes. Attributes are often referred as class data.
 A set of operations that portray the behavior of the objects of the class.
Operations are also referred as functions or methods.also referred as
functions or methods.
Example
Let us consider a simple class, Circle, that represents the geometrical figure circle in a two–
dimensional space. The attributes of this class can be identified as follows −
 x–coord, to denote x–coordinate of the center
 y–coord, to denote y–coordinate of the center
 a, to denote the radius of the circle
Some of its operations can be defined as follows −
 findArea(), method to calculate area
 findCircumference(), method to calculate circumference
 scale(), method to increase or decrease the radius
During instantiation, values are assigned for at least some of the attributes. If we create an
object my_circle, we can assign values like x-coord : 2, y-coord : 3, and a : 4 to depict its
state. Now, if the operation scale() is performed on my_circle with a scaling factor of 2, the
value of the variable a will become 8. This operation brings a change in the state of
my_circle, i.e., the object has exhibited certain behavior.
3. Messages: Objects communicate by message passing. Messages consist of the integrity of
the target object, the name of the requested operation, and any other action needed to perform
the function. Messages are often implemented as procedure or function calls.
4. Abstraction:- In object-oriented design, complexity is handled using abstraction.
Abstraction is the removal of the irrelevant and the amplification of the essentials.
5. Encapsupation :- Encapsulation is also called an information hiding concept. Encapsulation

23 | P a g e
is the process of binding both attributes and methods together within a class. Through
encapsulation, the internal details of a class can be hidden from outside. It permits the
elements of the class to be accessed from outside only through the interface provided by the
class. The data and operations are linked to a single unit. Encapsulation not only bundles
essential information of an object together but also restricts access to the data and methods
from the outside world.
6. Inheritance: OOD allows similar classes to stack up in a hierarchical manner where the
lower or sub-classes can import, implement, and re-use allowed variables and functions from
their immediate superclasses.This property of OOD is called an inheritance. This makes it
easier to define a specific class and to create generalized classes from specific ones
Example
From a class Mammal, a number of classes can be derived such as Human, Cat, Dog, Cow, etc.
Humans, cats, dogs, and cows all have the distinct characteristics of mammals. In addition, each has its
own particular characteristics. It can be said that a cow “is – a” mammal.
Types of Inheritance
o Single Inheritance − A subclass derives from a single super-class.
o Multiple Inheritance − A subclass derives from more than one super-classes.
o Multilevel Inheritance − A subclass derives from a super-class which in turn is derived
from another class and so on.
o Hierarchical Inheritance − A class has a number of subclasses each of which may have
subsequent subclasses, continuing for a number of levels, so as to form a tree structure.
o Hybrid Inheritance − A combination of multiple and multilevel inheritance so as to
form a lattice structure.
7. Polymorphism: OOD languages provide a mechanism where methods performing similar
tasks but vary in arguments, can be assigned the same name. This is known as
polymorphism, which allows a single interface is performing functions for different types.
Depending upon how the service is invoked, the respective portion of the code gets executed.
8. Relationships:- All the classes in the system are related with each other. The objects do not exist in
isolation, they exist in relationship with other objects. There are three types of object relationships −

o Aggregation − It indicates relationship between a whole and its parts.

24 | P a g e
o Association − In this, two classes are related or connected in some way such as one class
works with another to perform a task or one class acts upon other class.

o Generalization − The child class is based on parent class. It indicates that two classes
are similar but have some differences.

1.9.1. Concepts of Object

Question:What is meant by object? How are these created?

An object is a single unit having both data and the processes that operate on that data. For
example, in object oriented programming language like C++, the data and functions are bundled
together as a self contained unit called an object. An object is an entity which has some
properties and behavior associated with it. Objects are the basic run time entities in an object
oriented system. programming problems are analyzed in terms of objects. The main purpose of
using objects are following.

 They correspond to the real life entities.

 They provide interactions with the real world.

 They provide practical approach for the implementation of the solution.

All the objects have a state, behavior and identity.

 State of an object - The state or attributes are the built in characteristics or properties of an
object. For example, a T.V has the size, colour, model etc.

 Behaviour of the object - The behavior or operations of an object are its predefined functions.
For example, a T.V. can show picture , change channels, tune for a channel etc. in object
oriented programming terminology the behavior is implemented through methods.

 Object identity - Each object is uniquely identifiable. For example, the fridge can not become
the T.V.

Objects are the variables of a user defined data type called class. They are created in the same way as the
built in data type variables are created. When a class is defined , it does not define or create object of the
class. It only specifies the type of information that the object of that class will contain. Consider the class
triangle given below:

class triangle

25 | P a g e
{
private :
float side1;
float side2;
float side3;
float area;
public :
void read_data ( );
void area_triangle ( );
void display ( );
};
Objects of the class triangle can be declared as:

Triangle t;
Here t is object of the class triangle. A number of objects can also be declared as:

Triangle t1 ,t2, t3;

Object can also be created when a class is defined by placing their names immediately after the closing
brace. For example,

class triangle
{
...
} t1 ,t2, t3 ;

26 | P a g e
27 | P a g e

You might also like