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

goals and patterns

The document outlines the goals and principles of object-oriented design, emphasizing robustness, adaptability, and reusability. It details key principles such as abstraction, encapsulation, and modularity, which facilitate these goals, and discusses design patterns as templates for solving various software problems. Additionally, it explains the concept of inheritance in organizing software components hierarchically, allowing subclasses to inherit and extend functionalities from their superclasses.

Uploaded by

Bhargavi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

goals and patterns

The document outlines the goals and principles of object-oriented design, emphasizing robustness, adaptability, and reusability. It details key principles such as abstraction, encapsulation, and modularity, which facilitate these goals, and discusses design patterns as templates for solving various software problems. Additionally, it explains the concept of inheritance in organizing software components hierarchically, allowing subclasses to inherit and extend functionalities from their superclasses.

Uploaded by

Bhargavi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Goals, Principles, and Patterns:

Object-Oriented Design Goals:


• Software implementations should achieve robustness, adaptability, and reusability.
Robustness :
• In addition, we want software to be robust, that is, capable of handling unexpected inputs that are not explicitly
defined for its application. For example, if a program is expecting a positive integer (perhaps representing the
price of an item) and instead is given a negative integer, then the program should be able to recover gracefully
from this error.
Adaptability :
• Modern software applications, such as Web browsers and Internet search engines, typically involve large
programs that are used for many years. Software, therefore, needs to be able to evolve over time in response to
changing conditions in its environment. Thus, another important goal of quality software is that it achieves
adaptability (also called evolvability). Related to this concept is portability, which is the ability of software to run
with minimal change on different hardware and operating system platforms.
Reusability :
• Going hand in hand with adaptability is the desire that software be reusable, that is, the same code should be
usable as a component of different systems in various applications. Developing quality software can be an
expensive enterprise, and its cost can be offset somewhat if the software is designed in a way that makes it
easily reusable in future applications.
Object-Oriented Design Principles:
Chief among the principles of the object-oriented approach, which are intended to facilitate the goals are the following
• Abstraction
• Encapsulation
• Modularity
1. Abstraction :
• The notion of abstraction is to distill a complicated system down to its most fundamental parts. Typically, describing
the parts of a system involves naming them and explaining their functionality. Applying the abstraction paradigm to
the design of data structures gives rise to abstract data types (ADTs). An ADT is a mathematical model of a data
structure that specifies the type of data stored, the operations supported on them, and the types of parameters of the
operations. An ADT specifies what each operation does, but not how it does it.
2. Encapsulation:
• Another important principle of object-oriented design is encapsulation; different components of a software system
should not reveal the internal details of their respective implementations. One of the main advantages of
encapsulation is that it gives one programmer freedom to implement the details of a component, without concern
that other programmers will be writing code that intricately depends on those internal decisions.
3. Modularity:
• Modern software systems typically consist of several different components that must interact correctly in order for the
entire system to work properly. Keeping these interactions straight requires that these different components be well
organized. Modularity refers to an organizing principle in which different components of a software system are divided
into separate functional units.
Design Patterns :
• A pattern provides a general template for a solution that can be applied in many different situations. It
describes the main elements of a solution in an abstract way that can be specialized for a specific problem at
hand. It consists of a name, which identifies the pattern; a context, which describes the scenarios for which this
pattern can be applied; a template, which describes how the pattern is applied; and a result, which describes
and analyzes what the pattern produces.
• These design patterns fall into two groups—
a. patterns for solving algorithm design problems.
b. patterns for solving software engineering problems.
Inheritance:
• A natural way to organize various structural components of a software package is in a hierarchical fashion, with
similar abstract definitions grouped together in a level-by-level manner that goes from specific to more general as
one traverses up the hierarchy.
• An example of such a hierarchy is shown in Figure 2.3. Using mathematical notations, the set of houses is a subset of
the set of buildings, but a superset of the set of ranches. The correspondence between levels is often referred to as
an “is a” relationship, as a house is a building, and a ranch is a house.
• In object-oriented programming, the mechanism for a modular and hierarchical organization is a technique
known as inheritance. This allows a new class to be defined based upon an existing class as the starting point. In
object-oriented terminology, the existing class is typically described as the base class, parent class, or
superclass, while the newly defined class is known as the subclass or child class. We say that the subclass
extends the superclass.
• When inheritance is used, the subclass automatically inherits, as its starting point, all methods from the
superclass (other than constructors). The subclass can differentiate itself from its superclass in two ways. It may
augment the superclass by adding new fields and new methods. It may also specialize existing behaviors by
providing a new implementation that overrides an existing method.

You might also like