Miracle Academy
Unit III
What is Object Oriented Design?
Object Oriented Design (OOD) serves as part of the object oriented programming (OOP) process of lifestyle.
It is mainly the process of using an object methodology to design a computing system or application. This
technique enables the implementation of software based on the concepts of objects. Additionally, it is a
concept that forces programmers to plan out their code in order to have a better flowing program.
The origins of Object Oriented Design (OOD) is debated, but the first languages that supported it included
Simula and SmallTalk. The term did not become popular until Grady Booch wrote the first paper
titled Object-Oriented Design, in 1982. The chief objective of this type of software design is to define the
classes and their relationships, which are needed to build a system that meets the requirements contained in the
Software Requirement Specifications.
Moreover, it is the discipline of defining the objects and their interactions to solve a problem that was
identified and documented during the Object Oriented Analysis (OOA). In short, Object Oriented Design
(OOD) is a method of design encompassing the process of object oriented decomposition and a notation for
depicting both logical and physical models of the system under design. The other characteristics of Object
Oriented Design are as follow:
Objects are abstractions of the real-world or system entities and manage themselves.
The objects are independent and in an encapsulated state and representation information.
System functionality is expressed in terms of object services.
Shared data areas are eliminated.
Communication between objects is through message passing.
The objects may be distributed and may execute sequentially or in parallel.
Process of Object Oriented Design:
Understanding the process of any type of software related activity simplifies its development for the software
developer, programmer and tester. Whether you are executing functional testing, or making a test report, each
and every action has a process that needs to be followed by the members of the team. Similarly, Object
Oriented Design (OOD) too has a defined process, which if not followed carefully, can affect the performance
as well as the quality of the software. Therefore, to assist the team of software developers and programmers,
here is the process of Object Oriented Design (OOD):
1. To design classes and their attributes, methods, associations, structure, and even protocol, design
axiom is applied.
o The static UML class diagram is redefined and completed by adding details.
o Attributes are refined.
o Protocols and methods are designed by utilizing a UML activity diagram to represent the
methods algorithm.
o If required, redefine associations between classes, and refine class hierarchy and design with
inheritance.
o Iterate and refine again.
2. Design the access layer.
o Create mirror classes i.e., for every business class identified and created, create one access
class.
3. Identify access layer class relationship.
4. Simplify classes and their relationships. The main objective here is to eliminate redundant classes and
structures.
o Redundant Classes: Programmers should remember to not put two classes that perform
similar translate requests and translate results activities. They should simply select one and
eliminate the other.
o Method Classes: Revisit the classes that consist of only one or two methods, to see if they can
be eliminated or combined with the existing classes.
1
Miracle Academy
5. Iterate and refine again.
6. Design the view layer classes.
o Design the macro level user interface, while identifying the view layer objects.
o Design the micro level user interface.
o Test usability and user satisfaction.
o Iterate and refine.
7. At the end of the process, iterate the whole design. Re-apply the design axioms, and if required repeat
the preceding steps again.
Concepts of Object Oriented Design:
In Object Oriented Design (OOD), the technology independent concepts in the analysis model are mapped
onto implementing classes, constraints are identified, and the interfaces are designed, which results in a model
for the solution domain. In short, a detailed description is constructed to specify how the system is to be built
on concrete technologies. Moreover, Object Oriented Design (OOD) follows some concepts to achieve these
goals, each of which has a specific role and carries a lot of importance. These concepts are defined in detail
below:
1. Encapsulation: This is a tight coupling or association of data structure with the methods or functions
that act on the data. This is basically known as a class, or object (object is often the implementation of
a class).
2. Data Protection: The ability to protect some components of the object from external entities. This is
realized by language keywords to enable a variable to be declared as private or protected to the owning
class.
3. Inheritance: This is the ability of a class to extend or override the functionality of another class. This
so called child class has a whole section that is the parent class and then it has its own set of functions
and data.
4. Interface: A definition of functions or methods, and their signature that are available for use as well as
to manipulate a given instance of an object.
5. Polymorphism: This is the ability to define different functions or classes as having the same name, but
taking different data type.
Advantages of Object Oriented Design:
The discussion above has elaborated on several advantages of Object Oriented Design (OOD). From enabling
the implementation of a software based on the concepts of objects and deleting the shared data areas to
distributing and executing the object sequentially or in parallel, the benefits of this approach of software
design are numerous. Hence, provided here some of the other advantages of using Object Oriented Design
(OOD).
Easier to maintain objects.
Objects may be understood as stand-alone entities.
Objects are appropriate reusable components.
For some systems, there may be an obvious mapping from real entities to system objects.
2
Miracle Academy
Debugging, in computer programming and engineering, is a multistep process that involves identifying a
problem, isolating the source of the problem, and then either correcting the problem or determining a way to
work around it. The final step of debugging is to test the correction or workaround and make sure it works.
In software development, the debugging process begins when a developer locates a code error in a computer
program and is able to reproduce it. Debugging is part of the software testing process and is an integral part of
the entire software development lifecycle.
Debugging is defined as a process of analyzing and removing the error. It is considered necessary in most of
the newly developed software or hardware and in commercial products/ personal application programs. For
complex products, debugging is done at all the levels of the testing.
Debugging is considered to be a complex and time-consuming process since it attempts to remove errors at all
the levels of testing. To perform debugging, debugger (debugging tool) is used to reproduce the conditions in
which failure occurred, examine the program state, and locate the cause. With the help of debugger,
programmers trace the program execution step by step (evaluating the value of variables) and halt the
execution wherever required to reset the program variables. Note that some programming language packages
include a debugger for checking the code for errors while it is being written.
Some guidelines that are followed while performing debugging are discussed here.
1. Debugging is the process of solving a problem. Hence, individuals involved in debugging should understand
all the causes of an error before starting with debugging.
2. No experimentation should be done while performing debugging. The experimental changes instead of
removing errors often increase the problem by adding new errors in it.
3. When there is an error in one segment of a program, there is a high possibility that some other errors also exist
in the program. Hence, if an error is found in one segment of a program, rest of the program should be
properly examined for errors.
4. It should be ensured that the new code added in a program to fix errors is correct and is not introducing any
new error in it. Thus, to verify the correctness of a new code and to ensure that no new errors are introduced,
regression testing should be performed.
The Debugging Process
During debugging, errors are encountered that range from less damaging (like input of an incorrect function)
to catastrophic (like system failure, which lead to economic or physical damage). Note that with the increase
in number of errors, the amount of effort to find their causes also increases.
Once errors are identified in a software system, to debug the problem, a number of steps are followed, which
are listed below.
1 Defect confirmation/identification: A problem is identified in a system and a defect report is created. A
software engineer maintains and analyzes this error report and finds solutions to the following questions.
I. Does a .defect exist in the system?
II. Can the defect be reproduced?
III. What is the expected/desired behavior of the system?
IV. What is the actual behavior?
2 Defect analysis: If the defect is genuine, the next step is to understand the root cause of the problem.
Generally, engineers debug by starting a debugging tool (debugger) and they try to understand the root
cause of the problem by following a step-by-step execution of the program.
3 Defect resolution: Once the root cause of a problem is identified, the error can be resolved by making an
appropriate change to the system by fixing the problem.
When the debugging process ends, the software is retested to ensure that no errors are left undetected.
Moreover, it checks that no new errors are introduced in the software while making some changes to it during
the debugging process.
3
Miracle Academy
Debugging Strategies
Source code analyzers, which include security, common code errors and complexity analyzers, can be helpful
in debugging. A complexity analyzer can find modules that are so intricate as to be hard to understand and
test. Other debugging strategies include the following:
Static analysis -- the developer examines the code without executing the program.
Print debugging (also called tracing) -- the developer watches live or recorded print statements and
monitors flow.
Remote debugging -- the developer's debugger runs on a different system than the program that is being
debugged.
Post-mortem debugging -- the developer only stops to debug the program if it experiences fatal
exceptions.
As debugging is a difficult and time-consuming task, it is essential to develop a proper debugging strategy.
This strategy helps in performing the process of debugging easily and efficiently. The commonly-used
debugging strategies are debugging by brute force, induction strategy, deduction strategy, backtracking
strategy, and debugging by testing.
Brute force method of debugging is the most commonly used but least efficient method. It is generally used
when all other available methods fail. Here, debugging is done by taking memory (or storage) dumps.
Actually, the program is loaded with the output statements that produce a large amount
of information including the intermediate values. Analyzing this information may help to identify the errors
cause. However, using a memory dump for finding errors requires analyzing huge amount of information or
irrelevant data leading to waste of time and effort.
This strategy is a 'disciplined thought process' where errors can be debugged by moving outwards from the
particulars to the whole. This strategy assumes that once the symptoms of the errors are identified, and the
relationships between them are established, the errors can be easily detected by just looking at the symptoms
and the relationships. To perform induction strategy, a number of steps are followed, which are listed below.
1. Locating relevant data: All the information about a program is collected to identify the functions, which
are executed correctly and incorrectly.
2. Organizing data: The collected data is organized according to importance. The data can consist of possible
symptoms of errors, their location in the program, the time at which the symptoms occur during the execution
of the program and the effect of these symptoms on the program.
3. Devising (Planning) hypothesis (theory): The relationships among the symptoms are studied and a
hypothesis is devised that provides the hints about the possible causes of errors.
4. Proving hypothesis: In the final step, the hypothesis needs to be proved. It is done by comparing the data
in the hypothesis with the original data to ensure that the hypothesis explains the existence of hints
completely. In case, the hypothesis is unable to explain the existence of hints, it is either incomplete or
contains multiple errors in it.
Deduction Strategy
In this strategy, first step is to identify all the possible causes and then using the data each cause is analyzed
and eliminated if it is found invalid. Note that as in induction strategy, deduction strategy is also based on
some assumptions. To use this strategy following steps are followed.
1. Identifying the possible causes or hypotheses: A list of all the possible causes of errors is formed. Using
this list, the available data can be easily structured and analyzed.
4
Miracle Academy
2. Eliminating possible causes using the data: The list is examined to recognize the most probable cause of
errors and the rest of the causes are deleted.
3. Refining the hypothesis: By analyzing the possible causes one by one and looking for contradiction leads
to elimination of invalid causes. This results in a refined hypothesis containing few specific possible causes.
4. Proving the hypothesis: This step is similar to the fourth step in induction method.
Backtracking Strategy
This method is effectively used for locating errors in small programs. According to this strategy, when an error
has occurred, one needs to start tracing the program backward one step at a time evaluating the values of all
variables until the cause of error is found. This strategy is useful but in a large program with many thousands
lines of code, the number of backward paths increases and becomes unmanageably large.
Brute Force Method:
This is the foremost common technique of debugging however is that the least economical method. during this
approach, the program is loaded with print statements to print the intermediate values with the hope that a
number of the written values can facilitate to spot the statement in error. This approach becomes a lot of
systematic with the utilization of a symbolic program (also known as a source code debugger), as a result of
values of various variables will be simply checked and breakpoints and watchpoints can be easily set to check
the values of variables effortlessly.
Debugging by Testing
This debugging method can be used in conjunction with debugging by induction and debugging by deduction
methods. Additional test cases are designed that help in obtaining information to devise and prove a
hypothesis in induction method and to eliminate the invalid causes and refine the hypothesis in deduction
method. Note that the test cases used in debugging are different from the test cases used in testing process.
Here, the test cases are specifically designed to explore the internal program state.
Fault isolation
Self-test and fault isolation is a process of self-checking a system against threats and vulnerabilities. Most
modern-day systems have a processor-check ability that allows a computer to test itself and the rest of the
system for any fault. An emergency message is generated to the system log if any faulty hardware or software
is found.