0% found this document useful (0 votes)
83 views44 pages

OOSD BTCS505B PPT Unit 3

Uploaded by

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

OOSD BTCS505B PPT Unit 3

Uploaded by

Akp King
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Bachelor of Technology

(Computer Science)
Semester-V
Object Oriented System Design
BTCS505B

Mr. Kamlesh Kumar Yadav


Assistant Professor
Department of Computer Science & IT
Kalinga University
Naya Raipur (C.G.), India
Course Outcomes:

• To Understand the application development and analyze the insights of object oriented programming to
implement application

• To Understand, analyze and apply the role of overall modeling concepts (i.e. System, structural)

• To Understand, analyze and apply oops concepts (i.e. abstraction, inheritance)

• To learn concepts of C++ for understanding the implementation of object oriented concepts

• To learn the programming concepts to implement object oriented modeling.

2
REFERENCES/TEXT BOOKS
• James Rumbaugh et. al, “Object Oriented Modeling and Design”, PHI

• Grady Booch, James Rumbaugh, Ivar Jacobson, “The Unified Modeling Language
User Guide”, Pearson Education

• Object Oriented Programming With C++, E Balagurusamy, TMH

• C++ Programming, Black Book, Steven Holzner, dreamtech

• Object Oriented Programming in Turbo C++, Robert Lafore, Galgotia

• Object Oriented Programming with ANSI and Turbo C++, Ashok Kamthane, Pearson

• The Compete Reference C++, Herbert Schlitz, TMH

3
Cource Objectives & Learning Outcomes
• To Understand the application development and analyze the insights of object oriented programming to
implement application

• To Understand, analyze and apply the role of overall modeling concepts (i.e. System, structural)

• To Understand, analyze and apply oops concepts (i.e. abstraction, inheritance)

• To learn concepts of C++ for understanding the implementation of object oriented concepts

• To learn the programming concepts to implement object oriented modeling.

4
CONTENTS
BTCS
Semester- V
Paper Code –BTCS505B
Object Oriented System Design
S.No. Unit Name /Topic
1 Object Oriented Analysis

2 Object-Oriented Design - Advantages of OOAD:

3 Different terms related to object design

4 Three models in Object Design

5 Designing algorithms

6 Design optimization

7 Implementation of control

8 Structured analysis and structured design (SA/SD)

9 Jackson Structured Development (JSD)

10 Procedural v/s OOP

11 Object oriented language features 5


Unit - III

6
Object Oriented Analysis
Object-Oriented Analysis and Design (OOAD) is a software engineering methodology that involves using object-oriented concepts to design
and implement software systems. OOAD involves a number of techniques and practices, including object-oriented programming, design
patterns, UML diagrams, and use cases. Here are some important aspects of OOAD:
•Object-Oriented Programming: Object-oriented programming involves modeling real-world objects as software objects, with properties and
methods that represent the behavior of those objects. OOAD uses this approach to design and implement software systems.
•Design Patterns: Design patterns are reusable solutions to common problems in software design. OOAD uses design patterns to help
developers create more maintainable and efficient software systems.
•UML Diagrams: Unified Modeling Language (UML) is a standardized notation for creating diagrams that represent different aspects of a
software system. OOAD uses UML diagrams to represent the different components and interactions of a software system.
•Use Cases: Use cases are a way of describing the different ways in which users interact with a software system. OOAD uses use cases to
help developers understand the requirements of a system and to design software systems that meet those requirements.

7
Object-Oriented Analysis (OOA)
Object-Oriented Analysis (OOA) is the first technical activity performed as part of object-oriented software engineering. OOA introduces
new concepts to investigate a problem. It is based on a set of basic principles, which are as follows-
•The information domain is modeled.
•Behavior is represented.
•The function is described.
•Data, functional, and behavioral models are divided to uncover greater detail.
•Early models represent the essence of the problem, while later ones provide implementation details.

8
Object-Oriented Design (OOD)
An analysis model created using object-oriented analysis is transformed by object-oriented design into a design model that works as a plan
for software creation. OOD results in a design having several different levels of modularity i.e., The major system components are
partitioned into subsystems (a system-level “modular”), and data manipulation operations are encapsulated into objects (a modular form
that is the building block of an OO system.). In addition, OOD must specify some data organization of attributes and a procedural
description of each operation. Shows a design pyramid for object-oriented systems. It is having the following four layers.

9
•The Subsystem Layer : It represents the subsystem that enables software to achieve user requirements and implement technical
frameworks that meet user needs.

•The Class and Object Layer : It represents the class hierarchies that enable the system to develop using generalization and
specialization. This layer also represents each object.

•The Message Layer : It represents the design details that enable each object to communicate with its partners. It establishes internal
and external interfaces for the system.

•The Responsibilities Layer : It represents the data structure and algorithmic design for all the attributes and operations for each object.

The Object-Oriented design pyramid specifically emphasizes specific product or system design. Note, however, that another design layer
exists, which forms the base on which the pyramid rests. It focuses on the core layer the design of the domain object, which plays an
important role in building the infrastructure for the Object-Oriented system by providing support for human/computer interface
activities, task management.

10
Advantages of OOAD:
•Improved modularity: OOAD encourages the creation of small, reusable objects that can be combined to create more complex systems,
improving the modularity and maintainability of the software.
•Better abstraction: OOAD provides a high-level, abstract representation of a software system, making it easier to understand and maintain.
•Improved reuse: OOAD encourages the reuse of objects and object-oriented design patterns, reducing the amount of code that needs to be written
and improving the quality and consistency of the software.
•Improved communication: OOAD provides a common vocabulary and methodology for software developers, improving communication and
collaboration within teams.
•Reusability: OOAD emphasizes the use of reusable components and design patterns, which can save time and effort in software development by
reducing the need to create new code from scratch.
•Scalability: OOAD can help developers design software systems that are scalable and can handle changes in user demand and business
requirements over time.
•Maintainability: OOAD emphasizes modular design and can help developers create software systems that are easier to maintain and update over
time.
•Flexibility: OOAD can help developers design software systems that are flexible and can adapt to changing business requirements over time.
•Improved software quality: OOAD emphasizes the use of encapsulation, inheritance, and polymorphism, which can lead to software systems that
are more reliable, secure, and efficient.

11
The Different Terms related to object design are:

1.Objects: All entities involved in the solution design are known as objects. For example, person, banks, company, and users are considered as
objects. Every entity has some attributes associated with it and has some methods to perform on the attributes.

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.

12
The different terms related to object design are:

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. Encapsulation: Encapsulation is also called an information hiding concept. 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.

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.

13
Three Models in Object Design
Types of Models:
There are 3 types of models in the object oriented modeling and design are: Class Model, State Model, and Interaction Model. These are explained
as following below.
•Class Model:
The class model shows all the classes present in the system. The class model shows the attributes and the behavior associated with the objects.
The class diagram is used to show the class model.The class diagram shows the class name followed by the attributes followed by the functions or
the methods that are associated with the object of the class.Goal in constructing class model is to capture those concepts from the real world that
are important to an application.

•State Model:
State model describes those aspects of objects concerned with time and the sequencing of operations – events that mark changes, states that define
the context for events, and the organization of events and states.Actions and events in a state diagram become operations on objects in the class
model. State diagram describes the state model.

•Interaction Model:
Interaction model is used to show the various interactions between objects, how the objects collaborate to achieve the behavior of the system as a
whole.
The following diagrams are used to show the interaction model:
•Use Case Diagram
•Sequence Diagram
14
•Activity Diagram
Designing algorithms
The operations in the objects are defined using algorithms. An algorithm is a stepwise procedure that solves the problem laid down in an
operation. Algorithms focus on how it is to be done.
There may be more than one algorithm corresponding to a given operation. Once the alternative algorithms are identified, the optimal
algorithm is selected for the given problem domain. The metrics for choosing the optimal algorithm are −

•Computational Complexity − Complexity determines the efficiency of an algorithm in terms of computation time and memory
requirements.

•Flexibility − Flexibility determines whether the chosen algorithm can be implemented suitably, without loss of appropriateness in
various environments.

•Understandability − This determines whether the chosen algorithm is easy to understand and implement.

15
Design optimization
The analysis model captures the logical information about the system, while the design model adds details to support efficient
information access. Before a design is implemented, it should be optimized so as to make the implementation more efficient. The aim of
optimization is to minimize the cost in terms of time, space, and other metrics.
However, design optimization should not be excess, as ease of implementation, maintainability, and extensibility are also important
concerns. It is often seen that a perfectly optimized design is more efficient but less readable and reusable. So the designer must strike a
balance between the two.
The various things that may be done for design optimization are −
•Add redundant associations
•Omit non-usable associations
•Optimization of algorithms
•Save derived attributes to avoid re-computation of complex expressions

Addition of Redundant Associations


During design optimization, it is checked if deriving new associations can reduce access costs. Though these redundant associations may
not add any information, they may increase the efficiency of the overall model.

16
Omission of Non-Usable Associations
Presence of too many associations may render a system indecipherable and hence reduce the overall efficiency of the system. So, during
optimization, all non-usable associations are removed.

Optimization of Algorithms
In object-oriented systems, optimization of data structure and algorithms are done in a collaborative manner. Once the class design is in
place, the operations and the algorithms need to be optimized.
Optimization of algorithms is obtained by −
•Rearrangement of the order of computational tasks
•Reversal of execution order of loops from that laid down in the functional model
•Removal of dead paths within the algorithm

Saving and Storing of Derived Attributes


Derived attributes are those attributes whose values are computed as a function of other attributes (base attributes). Re-computation of
the values of derived attributes every time they are needed is a time–consuming procedure. To avoid this, the values can be computed
and stored in their computed forms.
However, this may pose update anomalies, i.e., a change in the values of base attributes with no corresponding change in the values of
the derived attributes. To avoid this, the following steps are taken −
•With each update of the base attribute value, the derived attribute is also re-computed.
•All the derived attributes are re-computed and updated periodically in a group rather than after each update.

17
Implementation of control
The object designer may incorporate refinements in the strategy of the state–chart model. In system design, a basic strategy for realizing
the dynamic model is made. During object design, this strategy is aptly embellished for appropriate implementation.
The approaches for implementation of the dynamic model are −

•Represent State as a Location within a Program − This is the traditional procedure-driven approach whereby the location of control
defines the program state. A finite state machine can be implemented as a program. A transition forms an input statement, the main
control path forms the sequence of instructions, the branches form the conditions, and the backward paths form the loops or iterations.

•State Machine Engine − This approach directly represents a state machine through a state machine engine class. This class executes
the state machine through a set of transitions and actions provided by the application.

•Control as Concurrent Tasks − In this approach, an object is implemented as a task in the programming language or the operating
system. Here, an event is implemented as an inter-task call. It preserves inherent concurrency of real objects.

18
Object Representation
Once the classes are identified, they need to be represented using object modelling techniques. This stage essentially involves constructing
UML diagrams.

There are two types of design models that need to be produced −


•Static Models − To describe the static structure of a system using class diagrams and object diagrams.
•Dynamic Models − To describe the dynamic structure of a system and show the interaction between classes using interaction diagrams
and state–chart diagrams.

19
Physical Packaging
Programs are made of discrete physical units that can be edited, compiled, imported, or otherwise manipulated. In C and Fortran the units
are source files; In Ada, it is packages. In object oriented languages, there are various degrees of packaging. In any large project, careful
partitioning of an implementation into packages is important to permit different persons to cooperatively work on a program.
Packaging include issues:
. Hiding internal information from outside view
. Coherence of entities
. Constructing physical modules.
Notation − Graphically, a package is represented by a tabbed folder. A package is generally drawn with only its name. However it may
have additional details about the contents of the package. See the following figures.

20
Physical Packaging
The different aspects of packaging are :

•Hiding Internal Information from Outside View − It allows a class to be viewed as a “black box” and permits class
implementation to be changed without requiring any clients of the class to modify code.

•Coherence of Elements − An element, such as a class, an operation, or a module, is coherent if it is organized on a consistent plan
and all its parts are intrinsically related so that they serve a common goal.

•Construction of Physical Modules − The following guidelines help while constructing physical modules −
Classes in a module should represent similar things or components in the same composite object.
Closely connected classes should be in the same module.
Unconnected or weakly connected classes should be placed in separate modules.
Modules should have good cohesion, i.e., high cooperation among its components.
A module should have low coupling with other modules, i.e., interaction or interdependence between modules should be
minimum.

21
Importance of Design Documentation:
•Requirements are well understood: With proper documentation, we can remove inconsistencies and conflicts about the
requirements. Requirements are well understood by every team member.

•Architecture/Design of product: Architecture/Design documents give us a complete overview of how the product look like and
better insight to the customer/user about their product.

•New Person can also work on the project: New person to the project can very easily understand the project through documentations
and start working on it. So, developers need to maintain the documentation and keep upgrading it according to the changes made in the
product/software.

•Everything is well Stated: This documentation is helpful to understand each and every working of the product. It explains each and
every feature of the product/software.

5. Proper Communication: Through documentation, we have good communication with every member who is part of the
project/software. Helpful in understanding role and contribution of each and every member.

22
Structured analysis and structured design (SA/SD)
Structured Analysis and Structured Design (SA/SD) is a diagrammatic notation that is designed to help people understand the system.
The basic goal of SA/SD is to improve quality and reduce the risk of system failure. It establishes concrete management specifications
and documentation. It focuses on the solidity, pliability, and maintainability of the system.
Structured Analysis and Structured Design (SA/SD) is a software development method that was popular in the 1970s and 1980s. The
method is based on the principle of structured programming, which emphasizes the importance of breaking down a software system into
smaller, more manageable components.
In SA/SD, the software development process is divided into two phases: Structured Analysis and Structured Design. During the
Structured Analysis phase, the problem to be solved is analyzed and the requirements are gathered. The Structured Design phase
involves designing the system to meet the requirements that were gathered in the Structured Analysis phase.
Structured Analysis and Structured Design (SA/SD) is a traditional software development methodology that was popular in the 1980s
and 1990s. It involves a series of techniques for designing and developing software systems in a structured and systematic way.

23
Structured analysis and structured design (SA/SD)
Here are some key concepts of SA/SD:
•Functional Decomposition: SA/SD uses functional decomposition to break down a complex system into smaller, more manageable
subsystems. This technique involves identifying the main functions of the system and breaking them down into smaller functions that can
be implemented independently.
•Data Flow Diagrams (DFDs): SA/SD uses DFDs to model the flow of data through the system. DFDs are graphical representations of the
system that show how data moves between the system’s various components.
•Data Dictionary: A data dictionary is a central repository that contains descriptions of all the data elements used in the system. It provides
a clear and consistent definition of data elements, making it easier to understand how the system works.
•Structured Design: SA/SD uses structured design techniques to develop the system’s architecture and components. It involves identifying
the major components of the system, designing the interfaces between them, and specifying the data structures and algorithms that will be
used to implement the system.
•Modular Programming: SA/SD uses modular programming techniques to break down the system’s code into smaller, more manageable
modules. This makes it easier to develop, test, and maintain the system.

24
SA/SD involves 2 phases
•Analysis Phase: It uses Data Flow Diagram, Data Dictionary, State Transition diagram and ER diagram.
•Design Phase: It uses Structure Chart and Pseudo Code.

1. Analysis Phase:
Analysis Phase involves data flow diagram, data dictionary, state transition diagram, and entity-relationship diagram.
•Data Flow Diagram:
In the data flow diagram, the model describes how the data flows through the system. We can incorporate the Boolean operators and &
or link data flow when more than one data flow may be input or output from a process.
For example, if we have to choose between two paths of a process we can add an operator or and if two data flows are necessary for a
process we can add an operator. The input of the process “check-order” needs the credit information and order information whereas the
output of the process would be a cash-order or a good-credit-order.

•Data Dictionary:
The content that is not described in the DFD is described in the data dictionary. It defines the data store and relevant meaning. A physical
data dictionary for data elements that flow between processes, between entities, and between processes and entities may be included.
This would also include descriptions of data elements that flow external to the data stores.
A logical data dictionary may also be included for each such data element. All system names, whether they are names of entities, types,
relations, attributes, or services, should be entered in the dictionary.

25
SA/SD involves 2 phases
•State Transition Diagram:
State transition diagram is similar to the dynamic model. It specifies how much time the function will take to execute and data access
triggered by events. It also describes all of the states that an object can have, the events under which an object changes state, the conditions
that must be fulfilled before the transition will occur and the activities were undertaken during the life of an object.

•ER Diagram:
ER diagram specifies the relationship between data store. It is basically used in database design. It basically describes the relationship
between different entities.

2. Design Phase:
Design Phase involves structure chart and pseudocode.
•Structure Chart:
It is created by the data flow diagram. Structure Chart specifies how DFS’s processes are grouped into tasks and allocated to the CPU. The
structured chart does not show the working and internal structure of the processes or modules and does not show the relationship between
data or data flows. Similar to other SASD tools, it is time and cost-independent and there is no error-checking technique associated with
this tool. The modules of a structured chart are arranged arbitrarily and any process from a DFD can be chosen as the central transform
depending on the analysts’ own perception. The structured chart is difficult to amend, verify, maintain, and check for completeness and
consistency.
•Pseudo Code: It is the actual implementation of the system. It is an informal way of programming that doesn’t require any specific
26
programming language or technology.
Advantages of Structured Analysis and Structured
Design (SA/SD)
•Clarity and Simplicity: The SA/SD method emphasizes breaking down complex systems into smaller, more manageable components,
which makes the system easier to understand and manage.
•Better Communication: The SA/SD method provides a common language and framework for communicating the design of a system,
which can improve communication between stakeholders and help ensure that the system meets their needs and expectations.
•Improved maintainability: The SA/SD method provides a clear, organized structure for a system, which can make it easier to maintain
and update the system over time.
•Better Testability: The SA/SD method provides a clear definition of the inputs and outputs of a system, which makes it easier to test
the system and ensure that it meets its requirements.

Disadvantages of Structured Analysis and Structured Design (SA/SD):


•Time-Consuming: The SA/SD method can be time-consuming, especially for large and complex systems, as it requires a significant
amount of documentation and analysis.
•Inflexibility: Once a system has been designed using the SA/SD method, it can be difficult to make changes to the design, as the
process is highly structured and documentation-intensive.
•Limited Iteration: The SA/SD method is not well-suited for iterative development, as it is designed to be completed in a single pass.
27
Jackson Structured Development (JSD)
Jackson System Development (JSD) is a method of system development that covers the software life cycle either directly or by
providing a framework into which more specialized techniques can fit. JSD can start from the stage in a project when there is only a
general statement of requirements. However many projects that have used JSD actually started slightly later in the life cycle, doing the
first steps largely from existing documents rather than directly with the users.

Phases of JSD
JSD has 3 phases:
•Modelling Phase: In the modelling phase of JSD, the designer creates a collection of entity structure diagrams and identifies the
entities in the system, the actions they perform, the attributes of the actions and the time order of the actions in the life of the entities.

•Specification Phase: This phase focuses on actually what is to be done? Previous phase provides the basic for this phase. An
sufficient model of a time-ordered world must itself be time-ordered. Major goal is to map progress in the real world on progress in
the system that models it.

•Implementation Phase: In the implementation phase JSD determines how to obtain the required functionality. Implementation way
of the system is based on the transformation of the specification into an efficient set of processes. The processes involved in it should
be designed in such a manner that it would be possible to run them on available software and hardware. 28
Merits of JSD:
•It is designed to solve the real-time problems.
•JSD modelling focuses on time.
•It considers simultaneous processing and timing.
•Provides functionality in the real world.
•It is a better approach for microcode applications.

Demerits of JSD:
•It is a poor methodology for high level analysis and database design.
•JSD is a complex methodology due to pseudo code representation.
•It is less graphically oriented as compared to SA/SD or OMT.
•It is a bit complex and difficult to understand.

29
Mapping object oriented concepts using non-
object oriented language
Implementing an object-oriented design in a non-object-oriented language requires basically the same steps as implementing a
design in an object-oriented language. The programmer using a non-object-oriented language must map object-oriented concepts into
the target language, whereas the compiler for an object-oriented language performs such: napping automatically. The steps required
to implement a design are:
•Translate classes into data structures
•Pass arguments to methods
•Allocate storage for objects
•Implement inheritance in data structures
•Implement method resolution
•Implement associations
•Deal with concurrency
•Encapsulate internal details of classes

30
Procedural v/s OOP
S No. On the basis of Procedural Programming Object-oriented programming
1. Definition It is a programming language that is derived Object-oriented programming is a computer
from structure programming and based upon programming design philosophy or
the concept of calling procedures. It follows a methodology that organizes/ models
step-by-step approach in order to break down a software design around data or objects
task into a set of variables and routines via a rather than functions and logic.
sequence of instructions.
2. Security It is less secure than OOPs. Data hiding is possible in object-oriented
programming due to abstraction. So, it is
more secure than procedural programming.
3. Approach It follows a top-down approach. It follows a bottom-up approach.
4. Data movement In procedural programming, data moves freely In OOP, objects can move and communicate
within the system from one function to another. with each other via member functions.
5. Orientation It is structure/procedure-oriented. It is object-oriented.
6. Access There are no access modifiers in procedural The access modifiers in OOP are named as
modifiers programming. private, public, and protected.
7. Inheritance Procedural programming does not have the There is a feature of inheritance in object-
concept of inheritance. oriented programming.
31
Procedural v/s OOP
S No. On the basis of Procedural Programming Object-oriented programming
8. Code reusability There is no code reusability present in It offers code reusability by using the feature
procedural programming. of inheritance.
9. Overloading Overloading is not possible in procedural In OOP, there is a concept of function
programming. overloading and operator overloading.
10. Importance It gives importance to functions over data. It gives importance to data over functions.
11. Virtual class In procedural programming, there are no In OOP, there is an appearance of virtual
virtual classes. classes in inheritance.
12. Complex It is not appropriate for complex problems. It is appropriate for complex problems.
problems
13. Data hiding There is not any proper way for data hiding. There is a possibility of data hiding.
14. Program division In Procedural programming, a program is In OOP, a program is divided into small
divided into small programs that are referred parts that are referred to as objects.
to as functions.
15. Examples Examples of Procedural programming include The examples of object-oriented
C, Fortran, Pascal, and VB. programming are- .NET, C#, Python, Java,
VB.NET, and C++.

32
Object Oriented Language Features

1. Inheritance
In layman’s terms, the attributes that you inherit from your parents are a simple illustration of inheritance. Classes may inherit
characteristics from other classes thanks to inheritance. Parent classes, in other words, extend properties and behaviors to child classes.
Reusability is aided via inheritance. Prototyping is another name for inheritance in JavaScript. A prototype object serves as a base from
which another object may derive its features and actions. Thus, you may use multiple prototype object templates to form a prototype
chain. Inheritance is passed down from one generation to the next. parent
Consider the application Polygon, which represents several Shapes. We’re expected to make two distinct sorts of polygons: a Rectangle
and a Triangle.

33
Object Oriented Language features
2. Encapsulation
Encapsulation is the process of enclosing all critical information inside an object and only revealing a subset of it to the outside world.
For example, code inside the class template defines attributes and behaviors.
The data and methods are then enclosed in the object when it is created from the class. Inside a class, encapsulation conceals the
underlying software code implementation and the internal data of the objects. Encapsulation necessitates designating certain fields as
private while others are made public.
•Methods and attributes only available from other methods in the same class make up the private/internal interface.
•Methods and attributes that are available from outside the class are known as the public / external interface.
•Encapsulation Demonstration in Real-Time
One of the most practical examples of encapsulation is a school bag. Our books, pencils, and other items may be kept in our school bag.
The following are some of the advantages of encapsulation:
•Data Hiding: In this case, the user will be unaware of the class’s internal implementation. Even the user will have no idea how the
class stores data in variables. He or she will only be aware that the values are sent to a setter method and that variables are initialised
with that value.
•Increased Flexibility: Depending on our needs, we may make the variables of the class read-only or write-only. If you want to make
the variables read-only, remove the setter methods like setName(), setAge(), and so on from the above programme. If you want to make
the variables write-only, remove the get methods like getName(), getAge(), and so on from the above programme.
•It also promotes reusability and makes it simple to alter to meet new needs.
34
Object oriented language features
3. Abstraction
Abstraction refers to the user’s interaction with just a subset of an object’s characteristics and operations. To access a complicated item,
abstraction uses simpler, high-level techniques.
•Simple items are used to show complexity.
•Keep complicated information hidden from the user.
Simple classes are used to indicate complexity in abstraction. Encapsulation is an extension of abstraction.
A Real-Life Example of Abstraction
Abstraction reveals just the most significant facts to the user while hiding the underlying intricacies. For example, when we ride a bike,
we only know how to ride it but not how it works. We also have no idea how a bike works on the inside.
4. Polymorphism
Polymorphism refers to the creation of items that have similar behavior. For example, objects may override common parent behaviors
with particular child behaviors through inheritance. Method overriding and method overloading are two ways that polymorphism
enables the same method to perform various actions.
Examine how Polymorphism and the actual world are interconnected with examples.
Take, for example, your mobile phone. It has the capability of storing your Contacts. Consider the following scenario: you wish to store
two numbers for one individual. You may do this by storing the second number under the same name as the first.
Consider the following scenario: you wish to store two numbers for the same individual in an object-oriented language such as Java.
Create a function that will accept as arguments two integers and the name of the individual to some function void createContact that will
be defined later (String name, int number1, int number2). 35
Object oriented language features
5. Method Overriding
Method overriding is used in runtime polymorphism. When a child class overrides a parent class’s method, the child class might offer an
alternative implementation.
Consider a family of three, consisting of the father, mother, and son. The father makes the decision to teach his kid to shoot. As a result,
he brings him to the range with his favorite rifle and teaches him how to aim and fire at targets. The father, on the other hand, is right-
handed, while the kid is left-handed. So they each have their own way of handling the pistol! Because of their differing orientations, the
father was concerned that he may not be able to teach his son how to shoot.
The son, on the other hand, was astute and chose to flip his father’s hands, putting his dominant hand on the trigger rather than the
father’s. Specifically, the right hand. By significantly changing the learning process, the son was able to grasp the skill of shooting!
Method overriding is the term used in programming to describe this idea.
6. Method Overloading
Method overloading is used in Compile Time Polymorphism. Although two methods or functions may have the same name, the number
of arguments given into the method call may vary. Therefore, depending on the number of parameters entered, you may obtain different
results.
With the help of a simple example, it may be comprehended in simple words. A class addition contains two add() methods, one with
arguments int a and int b and the other with three integer parameters, int a, int b, and int c. As a result, the add() function is considered
overloaded.
The amount of arguments given in the method calling statement determines which method is performed. For example, add(20,30) calls
the two-parameter add() function, whereas add(10,20,30) calls the three-parameter add method.
36
Object oriented language features
7. Objects
An object is a self-contained segment with the attributes and processes needed to make data usable in programming terms. From an
object-oriented perspective, objects are the main building pieces of programs. In each application you create, you may employ a variety of
objects of various sorts. Each kind of object is derived from a specific class of that type. Consider an object to be a sculpt of the real-
world perceptions, processes, or objects that are important to the application you’re designing.
A variable, function, or data structure may all be considered an object. The term “object” in object-oriented programming refers to a
specific instance of a class. Objects are used in software development to combine data components with methods that alter them, allowing
for the usage of abstract data structures. Objects in object-oriented programming are answers to the idea of inheritance, resulting in
improved program dependability, simpler software maintenance, library administration, and task division in programmer teams. Of basic
terms, “Objects” are the fundamental data types in object-oriented programming languages and are used to build object-oriented
programming.
8. Classes
In the oops concept, a class is a construct that is used to describe an individual type. The class is instantiated into instances of itself –
referred to as class instances or simply objects. A class defines ingredient members that allow its instances to have position and behavior.
Member variables or instance variables facilitate a class instance to maintain its position. On the other hand, other kinds of members,
especially methods, allow the behavior of class instances. Simply classes consequently define the type of their instances. A class usually
represents a person, place or thing, or something.
For example, a “Bird” class would symbolize the properties and functionality of birds. A single, particular bird would be an instance of
the “Bird” class, an object of the type “Bird”. There is a set of access specifiers in classes. private (or class-private) specifiers restrict the
entrance to the class itself. Only the methods that are elements of a similar class only can access private members. protected (or class-
protected) specifies enables the class itself and all classes under it (sub-classes) to access the member and public means that member
37 can
Object oriented language features
9. Constructors and Destructors
Constructors in most object-oriented languages have the same name as the class and are public. Constructors may be overloaded, which means that
multiple argument lists can be used with the same name. The function Object() { [native code] } in PHP 5.0 is the function _construct ().
Normally, attribute values would be initialised in a function Object() { [native code] }. The _destruct() method is optional, although it might be
used to implement code that cleans up once an object is destroyed, such as shutting files or database connections.

38
MCQ
1. The idea of the interface was introduced to solve the problem of ___.
A. Generalization
B. Association
C. Multiple inheritances
D. Dependency

2. The third phase of OOAD design deals with ___.


A. Designing view layer classes
B. Designing attributes
C. Designing access layer classes
D. Refining UML class diagrams

3. In object oriented design it is important to describe the ___ between the associated classes in an application.
A. Protocol
B. Function
C. Constraint
D. Procedure

4.___are objects that basically act as containers of data.


A. Display object
B. Value object
C. Application structure
D. Data object

39
MCQ
5. ___ interferes with the user’s ability to use the conceptual model of how the application works.
A. Task automation
B. Interface
C. Prototyping
D. Modes

6. An ___ is a user playing a role with respect to the system.


A. actor
B. computer
C. Operator
D. Mouse

7. The vertcal dimension of a sequence diagram shows


A. abstract
B. line
C. time
D. messages

8. To distunguish between active and non-active object which property is applied?


A. abstraction
B. polymophism
C. concurrency
D. aggregation

40
MCQ
9. A ————– is an abstraction of something for the purpose of understanding it before building it.
A. Mock-up
B. Model
C. Prototype
D. All of the above

10. Object-Oriented Modelling allows-


A. Higher productivity
B. lower maintenance cost
C. better quality can be achieved
D. All of the above

11. The Object Oriented Modeling for building systems takes the ———– as the basis.
A. Class
B. Object
C. Model
D. Modules

12. An/A ————– is a data value held by objects in a class.


A. Data
B. Functions
C. Attributes
D. None of the above

41
MCQ
13.The object model describes the ————- of a system.
A. static
B. structural
C. data aspects
D. Static, structural, and data aspects

14.Activity diagram is a special kind of Diagram


A. State Chart Diagram
B. Interaction Diagram
C. Use Case Diagram
D. Component

15. The functional model describes the —————- aspects of a system.


A. Behavioral
B. transformational
C. functional
D. All of the above

16. When more than one (derived) class inherits properties (data and operations) from a single base class, it is called
——-
A. Hybrid inheritance
B. hierarchical inheritance
C. Multiple Inheritance
D. None

42
MCQ
17. Combination of single, multiple, hierarchical, and multilevel inheritance forms
A. Hierarchical Inheritance
B. Hybrid inheritance
C. Containership
D. None

18. When is the object created with a new keyword?


A. At run time
B. At compile time
C. Depends on the code
D. None

19. Which of the following model implement control aspects of the system?
A. Object model
B. Dynamic model
C. Functional model
D. None of the above

20. A ————– is a sequence of events that occurs during one particular execution of a system
A. State of the system
B. Scenario
C. Environment
D. None of the above

43
Thank You !!

44

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy