Information Technology Reference
In-Depth Information
principles of object-oriented design facilitate revisions: open-closed principle, once
and only once principle, dependency inversion principle, and Liskov substitution
principle (Laplante, 2005).
The open-closed principle states that classes should be open to extension but at
the same time closed to modification. In other words, the object should be allowed to
react differently to new requirements, but at the same time, the code cannot change
internally. This can be done by creating a super class, but it can represent unbounded
variation by subclassing.
The once and only once principle is the idea that any portion of the software, be
it algorithms, documentation, or logic, should exist only in one place. This makes
maintenance and comprehension easier and isolates future changes.
The dependency principle states that high-level modules should not depend on
low-level modules. Instead both should depend on abstractions, where abstractions
should not depend on details, but details should depend on abstractions.
Finally, Liskov expressed the principle that “what is wanted here is something like
the following substitution property: if for each object o1 of type S there is an object
o2 of type T such that for all programs P defined in terms of T, the behavior of P is
unchanged when o1 is substituted for o2 then S is a subtype of T” (Laplante, 2005,
p. 249). This principle has led to the concept of type inheritance and is the basis for
polymorphism, which was discussed earlier.
Design patterns can be defined as reusable solutions to commonly occurring
problems in software design. It should be noted that a design pattern is not a finished
design that can be transformed directly into code but a template for how to solve
a problem. Object-oriented design patterns typically show relationships between
objects without specifying the final objects involved. Indeed, developing software
can be very tricky. Thus, design patterns have to be implemented such that they can
solve the current problem, while the software must be general enough that it also
can address future problems as well. In fact, most experienced designers know not to
solve every problem from first principles but to reuse principles that they have leaned
from previous designs.
Generally, a design pattern includes four main elements: a name, the problem to be
solved, the solution to the problem, and the consequences of the solution. The problem
to be solved describes when the design pattern should be applied in terms of specific
design problems. The problem to be solved can describe class structures that indicate
an inflexible design and might include conditions that have to be met first before the
design pattern can be applied. The solution describes the elements that the design
consists of. The solution does not describe a concrete design or implementation but
provides a general arrangement of how a general arrangement of objects and classes
solves the problem (Khoo, 2009).
UML is a standardized, general-purpose language that is used to construct an
object-oriented software system under development, and it offers a standard way
to write a system's design. Indeed, UML is sort of like a blueprint for building a
house to ensure consistency and structure. UML includes concepts with a notation
and rules for usage, where the notation has a set of shapes that can be combined in
Search WWH ::




Custom Search