Introduction To Software Construction
Introduction To Software Construction
The term software construction refers to the detailed creation of working software
through a combination of coding, verification, unit testing, integration testing, and
debugging. The Software Construction knowledge area (KA) is linked to all the
other KAs, but it is most strongly linked to Software Design and Software Testing
because the software construction process involves significant software design and
testing. The process uses the design output and provides an input to testing
(“design” and “testing” in this case referring to the activities, not the KAs).
Boundaries between design, construction, and testing (if any) will vary depending
on the software life cycle processes that are used in a project. Although some
detailed design may be performed prior to construction, much design work is
performed during the construction activity. Thus, the Software Construction KA is
closely linked to the Software Design KA. Throughout construction, software
engineers both unit test and integration test their work. Thus, the Software
construction KA is closely linked to the Software Testing KA as well. Software
construction typically produces the highest number of configuration items that
need to be managed in a software project (source files, documentation, test cases,
and so on). Thus, the Software Construction KA is also closely linked to the
Software Configuration Management KA. While software quality is important in
all the KAs, code is the ultimate deliverable of a software project, and thus the
Software Quality KA is closely linked to the Software Construction KA. Since
software construction requires knowledge of algorithms and of coding practices, it
is closely related to the Computing Foundations KA, which is concerned with the
computer science foundations that support the design and construction of software
products. It is also related to project management, insofar as the management of
construction can present considerable challenges.
Breakdown of Topics for Software Construction
minimizing complexity
anticipating change
constructing for verification
reuse
standards in construction.
The first four concepts apply to design as well as to construction. The following
sections define these concepts and describe how they apply to construction.
[1]
Most people are limited in their ability to hold complex structures and information
in their working memories, especially over long periods of time. This proves to be
a major factor influencing how people convey intent to computers and leads to one
of the strongest drives in software construction: minimizing complexity. The need
to reduce complexity applies to essentially every aspect of software construction
and is particularly critical to testing of software constructions. In software
construction, reduced complexity is achieved through emphasizing code creation
that is simple and readable rather than clever. It is accomplished through making
use of standards (see section 1.5, Standards in Construction), modular design (see
section 3.1, Construction Design), and numerous other specific techniques (see
section 3.3, Coding). It is also supported by construction-focused quality
techniques (see section 3.7, Construction Quality).
[1]
Most software will change over time, and the anticipation of change drives many
aspects of software construction; changes in the environments in which software
operates also affect software in diverse ways. Anticipating change helps software
engineers build extensible software, which means they can enhance a software
product without disrupting the underlying structure. Anticipating change is
supported by many specific techniques (see section 3.3, Coding).
[1]
Constructing for verification means building software in such a way that faults can
be readily found by the software engineers writing the software as well as by the
testers and users during independent testing and operational activities. Specific
techniques that support constructing for verification include following coding
standards to support code reviews and unit testing, organizing code to support
automated testing, and restricting the use of complex or hard-to-understand
language structures, among others.
1.4 Reuse
[2]
[1]
2 Managing Construction
[1]
[1]
3 Practical Considerations
[1]
[1]
Formal notations rely less on intuitive, everyday meanings of words and text
strings and more on definitions backed up by precise, unambiguous, and formal (or
mathematical) definitions. Formal construction notations and formal methods are
at the semantic base of most forms of system programming notations, where
accuracy, time behavior, and testability are more important than ease of mapping
into natural language. Formal constructions also use precisely defined ways of
combining symbols that avoid the ambiguity of many natural language
constructions.
Visual notations rely much less on the textual notations of linguistic and formal
construction and instead rely on direct visual interpretation and placement of
visual entities that represent the underlying software. Visual construction tends to
be somewhat limited by the difficulty of making “complex” statements using only
the arrangement of icons on a display. However, these icons can be powerful tools
in cases where the primary programming task is simply to build and "adjust" a
visual interface to a program, the detailed behavior of which as an underlying
definition.
3.3 Coding
[1]
[1]
Construction involves two forms of testing, which are often performed by the
software engineer who wrote the code:
Unit testing
Integration testing.
The purpose of construction testing is to reduce the gap between the time when
faults are inserted into the code and the time when those faults are detected,
thereby reducing the cost incurred to fix them. In some instances, test cases are
written after code has been written. In other instances, test cases may be created
before code is written. Construction testing typically involves a subset of the
various types of testing, which are described in the Software Testing KA. For
instance, construction testing does not typically include system testing, alpha
testing, beta testing, stress testing, configuration testing, usability testing, or other
more specialized kinds of testing. Two standards have been published on the topic
of construction testing: IEEE Standard 829-1998, IEEE Standard for Software Test
Documentation, and IEEE Standard 1008-1987, IEEE Standard for Software Unit
Testing.
(See sections 2.1.1., Unit Testing, and 2.1.2., Integration Testing, in the Software
Testing KA for more specialized reference material.)
3.5 Construction for Reuse
[2]
Construction for reuse creates software that has the potential to be reused in the
future for the present project or other projects taking a broadbased, multisystem
perspective. Construction for reuse is usually based on variability analysis and
design. To avoid the problem of code clones, it is desired to encapsulate reusable
code fragments into well-structured libraries or components. The tasks related to
software construction for reuse during coding and testing are as follows:
[2]
Construction with reuse means to create new software with the reuse of existing
software assets. The most popular method of reuse is to reuse code from the
libraries provided by the language, platform, tools being used, or an organizational
repository. Asides from these, the applications developed today widely make use
of many open-source libraries. Reused and off-the-shelf software often have the
same—or better—quality requirements as newly developed software (for example,
security level). The tasks related to software construction with reuse during coding
and testing are as follows:
The selection of the reusable units, databases, test procedures, or test data.
The evaluation of code or test reusability.
The integration of reusable software assets into the current software.
The reporting of reuse information on new code, test procedures, or test data.
[1]
unit testing and integration testing (see section 3.4, Construction Testing)
test-first development (see section 2.2 in the Software Testing KA)
use of assertions and defensive programming
debugging
inspections
technical reviews, including security-oriented reviews (see section 2.3.2 in
the Software Quality KA)
static analysis (see section 2.3 of the Software Quality KA)
The specific technique or techniques selected depend on the nature of the software
being constructed as well as on the skillset of the software engineers performing
the construction activities. Programmers should know good practices and common
vulnerabilities—for example, from widely recognized lists about common
vulnerabilities. Automated static analysis of code for security weaknesses is
available for several common programming languages and can be used in security-
critical projects.
3.8 Integration
[1]
4 Construction Technologies
[3]
[1]
[4]
Parameterized types, also known as generics (Ada, Eiffel) and templates (C++),
enable the definition of a type or class without specifying all the other types it uses.
The unspecified types are supplied as parameters at the point of use. Parameterized
types provide a third way (in addition to class inheritance and object composition)
to compose behaviors in object-oriented software
[1]
The way that errors are handled affects software’s ability to meet requirements
related to correctness, robustness, and other nonfunctional attributes. Assertions
are sometimes used to check for errors. Other error handling techniques—such as
returning a neutral value, substituting the next piece of valid data, logging a
warning message, returning an error code, or shutting down the software—are also
used. Exceptions are used to detect and process errors or exceptional events. The
basic structure of an exception is that a routine uses throw to throw a detected
exception and an exception handling block will catch the exception in a try-catch
block. The try-catch block may process the erroneous condition in the routine or it
may return control to the calling routine. Exception handling policies should be
carefully designed following common principles such as including in the exception
message all information that led to the exception, avoiding empty catch blocks,
knowing the exceptions the library code throws, perhaps building a centralized
exception reporter, and standardizing the program’s use of exceptions. Fault
tolerance is a collection of techniques that increase software reliability by detecting
errors and then recovering from them if possible or containing their effects if
recovery is not possible. The most common fault tolerance strategies include
backing up and retrying, using auxiliary code, using voting algorithms, and
replacing an erroneous value with a phony value that will have a benign effect.
[5]
[1]
[1]
To achieve more flexibility, a program is often constructed to support late binding
time of its variables. Runtime configuration is a technique that binds variable
values and program settings when the program is running, usually by updating and
reading configuration files in a just-in-time mode. Internationalization is the
technical activity of preparing a program, usually interactive software, to support
multiple locales. The corresponding activity, localization, is the activity of
modifying a program to support a specific local language. Interactive software may
contain dozens or hundreds of prompts, status displays, help messages, error
messages, and so on. The design and construction processes should accommodate
string and character-set issues including which character set is to be used, what
kinds of strings are used, how to maintain the strings without changing the code,
and translating the strings into different languages with minimal impact on the
processing code and the user interface.
[1] [6]
[7]
A synchronization primitive is a programming abstraction provided by a
programming language or the operating system that facilitates concurrency and
synchronization. Well-known concurrency primitives include semaphores,
monitors, and mutexes. A semaphore is a protected variable or abstract data type
that provides a simple but useful abstraction for controlling access to a common
resource by multiple processes or threads in a concurrent programming
environment. A monitor is an abstract data type that presents a set of programmer-
defined operations that are executed with mutual exclusion. A monitor contains the
declaration of shared variables and procedures or functions that operate on those
variables. The monitor construct ensures that only one process at a time is active
within the monitor. A mutex (mutual exclusion) is a synchronization primitive that
grants exclusive access to a shared resource by only one process or thread at a
time.
4.11 Middleware
[3] [6]
Middleware is a broad classification for software that provides services above the
operating system layer yet below the application program layer. Middleware can
provide runtime containers for software components to provide message passing,
persistence, and a transparent location across a network. Middleware can be
viewed as a connector between the components that use the middleware. Modern
message-oriented middleware usually provides an Enterprise Service Bus (ESB),
which supports service-oriented interaction and communication between multiple
software applications.
[6]
[6] [7]
[1]
[1]
[1] [2]
Unit testing verifies the functioning of software modules in isolation from other
software elements that are separately testable (for example, classes, routines,
components). Unit testing is often automated. Developers can use unit testing tools
and frameworks to extend and create automated testing environment. With unit
testing tools and frameworks, the developer can code criteria into the test to verify
the unit’s correctness under various data sets. each individual test is implemented
as an object, and a test runner runs all of the tests. During the test execution, those
failed test cases will be automatically flagged and reported.
[1]
Performance analysis tools are usually used to support code tuning. The most
common performance analysis tools are profiling tools. An execution profiling tool
monitors the code while it runs and records how many times each statement is
executed or how much time the program spends on each statement or execution
path. Profiling the code while it is running gives insight into how the program
works, where the hot spots are, and where the developers should focus the code
tuning efforts.Program slicing involves computation of the set of program
statements (i.e., the program slice) that may affect the values of specified variables
at some point of interest, which is referred to as a slicing criterion. Program slicing
can be used for locating the source of errors, program understanding, and
optimization analysis. Program slicing tools compute program slices for various
programming languages using static or dynamic analysis methods.
Further Readings
This standard specifies the processes, activities, and tasks to be applied during each
phase of the software life cycle to enable a software product to be constructed from
reusable assets. It covers the concept of reuse-based development and the
processes of construction for reuse and construction with reuse.
IEEE Std. 12207-2008 (a.k.a. ISO/IEC 12207:2008) Standard for Systems and
Software Engineering—Software Life Cycle Processes, IEEE, 2008 [9].
[5] S.J. Mellor and M.J. Balcer, Executable UML: A Foundation for Model-Driven
Architecture, 1st ed., Addison-Wesley, 2002.
[7] A. Silberschatz, P.B. Galvin, and G. Gagne, Operating System Concepts, 8th
ed., Wiley, 2008.
[9] IEEE, "IEEE Std. 12207-2008 (a.k.a. ISO/IEC 12207:2008) Standard for
Systems and Software Engineering—Software Life Cycle Processes", IEEE, 2008.