Page 109 - DCAP405_SOFTWARE_ENGINEERING
P. 109
Software Engineering
Notes for optimizing a single measurable quantity, but problems requiring optimization of a
combination of quantities are almost always NP-complete. Although it is not a proven fact,
most experts in complexity theory believe that NP-complete problems cannot be solved by
algorithms that run in polynomial time.
In view of this, it makes sense to separate handling of different values. This can be done either
by dealing with different values at different times in the software development process, or by
structuring the design so that responsibility for achieving different values is assigned to different
components.
As an example of this, run-time efficiency is one value that frequently conflicts with other
software values. For this reason, most software engineers recommend dealing with efficiency as
a separate concern. After the software is design to meet other criteria, it’s run time can be
checked and analysed to see where the time is being spent.
!
Caution If necessary, the portions of code that are using the greatest part of the runtime can
be modified to improve the runtime.
Modularity
The principle of modularity is a specialization of the principle of separation of concerns. Following
the principle of modularity implies separating software into components according to
functionality and responsibility.
Abstraction
The principle of abstraction is another specialization of the principle of separation of concerns.
Following the principle of abstraction implies separating the behavior of software components
from their implementation. It requires learning to look at software and software components
from two points of view: what it does, and how it does it.
Failure to separate behavior from implementation is a common cause of unnecessary coupling.
For example, it is common in recursive algorithms to introduce extra parameters to make the
recursion work. When this is done, the recursion should be called through a non-recursive shell
that provides the proper initial values for the extra parameters. Otherwise, the caller must deal
with a more complex behavior that requires specifying the extra parameters. If the implementation
is later converted to a non-recursive algorithm then the client code will also need to be changed.
Task In a group of four explain that what you have understood by the statement. “Design
by contract is an important methodology for dealing with abstraction.”
Anticipation of Change
Computer software is an automated solution to a problem. The problem arises in some context,
or domain that is familiar to the users of the software. The domain defines the types of data that
the users need to work with and relationships between the types of data.
Software developers, on the other hand, are familiar with a technology that deals with data in an
abstract way. They deal with structures and algorithms without regard for the meaning or
importance of the data that is involved. A software developer can think in terms of graphs and
graph algorithms without attaching concrete meaning to vertices and edges.
102 LOVELY PROFESSIONAL UNIVERSITY