O'Reilly logo

Essentials of Software Engineering, 3rd Edition by Barbara Bernal, Orlando Karam, Frank Tsui

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.2.4 Design Decisions
The steps and thoughts related to design decisions for the sorting problem can be sum-
marized as follows:
n
Programming language: Typically this will be a technical design decision, although it is
not uncommon to be given as a design constraint. The type of programming needed,
the performance and portability requirements, and the technical expertise of the devel-
opers often heavily influence the choice of the programming language.
n
Algorithms: When implementing systems, there are usually several pieces that can be
influenced by the choice of algorithms. In our example, of course, there are a variety
of algorithms we can choose among to sort a collection of objects. The language used
and the libraries available will influence the choice of algorithms. For example, to sort,
the easiest solution would be to use a standard facility provided by the programming
language rather than to implement your own. Thus, use whatever algorithm that
implementation chooses. Performance will usually be the most important influence
in the choice of an algorithm, but it needs to be balanced with the effort required to
implement it, and the familiarity of the developers with it. Algorithms are usually design
decisions, but they can be given as design constraints or even considered functional
requirements. In many business environments there are regulations that mandate
specific algorithms or mathematical formulas to be used, and in many scientific appli-
cations the goal is to test several algorithms, which means that you must use certain
algorithms.
1.3 Testing
It is always a good idea to test a program, both while it is being developed and after it is
completed. This may sound like obvious advice, but it is not always followed. There are
several kinds of testing, including acceptance testing, which refers to testing done by
clients, or somebody on their behalf, to make sure the program runs as specified. If this
testing fails, the client can reject the program. The developers should run their own tests,
prior to the client acceptance testing, to determine if the program works.
Although there are many types of testing performed by the development organiza-
tion, the most important kind of testing for the individual programmer is unit testing—a
process followed by a programmer to test each piece or unit of software. When writing
code, you must also write tests to check each module, function, or method you have
written. Some methodologies, notably Extreme Programming, go as far as saying that
programmers should write the test cases before writing the code; see the discussion on
Extreme Programming in Beck (1999). Inexperienced programmers often do not realize
the importance of testing. They write functions or methods that depend on other func-
tions or methods that have not been properly tested. When a method fails, they do not
know which function or method is actually failing.
Another useful distinction is between black-box and white-box testing. In black-box
testing, the test cases are based only on the requirement specifications, not on the
implementation code. In white-box testing, the test cases can be designed while looking
6 Chapter 1 Writing a Program
91998_CH01_Tsui.indd 6 1/10/13 6:19:01 AM

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required