Professional Documents
Culture Documents
Software Construction
Software Construction
SOFTWARE CONSTRUCTION
3-1
3-2 SWEBOK® Guide V3.0
these concepts and describe how they apply to independent testing and operational activities.
construction. Specific techniques that support constructing for
verification include following coding standards to
1.1. Minimizing Complexity support code reviews and unit testing, organizing
[1*] code to support automated testing, and restrict-
ing the use of complex or hard-to-understand lan-
Most people are limited in their ability to hold guage structures, among others.
complex structures and information in their
working memories, especially over long peri- 1.4. Reuse
ods of time. This proves to be a major factor [2*]
influencing how people convey intent to com-
puters and leads to one of the strongest drives Reuse refers to using existing assets in solving
in software construction: minimizing complex- different problems. In software construction, typ-
ity. The need to reduce complexity applies to ical assets that are reused include libraries, mod-
essentially every aspect of software construction ules, components, source code, and commercial
and is particularly critical to testing of software off-the-shelf (COTS) assets. Reuse is best prac-
constructions. ticed systematically, according to a well-defined,
In software construction, reduced complexity repeatable process. Systematic reuse can enable
is achieved through emphasizing code creation significant software productivity, quality, and
that is simple and readable rather than clever. It cost improvements.
is accomplished through making use of standards Reuse has two closely related facets: “construc-
(see section 1.5, Standards in Construction), tion for reuse” and “construction with reuse.” The
modular design (see section 3.1, Construction former means to create reusable software assets,
Design), and numerous other specific techniques while the latter means to reuse software assets in
(see section 3.3, Coding). It is also supported by the construction of a new solution. Reuse often
construction-focused quality techniques (see sec- transcends the boundary of projects, which means
tion 3.7, Construction Quality). reused assets can be constructed in other projects
or organizations.
1.2. Anticipating Change
[1*] 1.5. Standards in Construction
[1*]
Most software will change over time, and the
anticipation of change drives many aspects of Applying external or internal development stan-
software construction; changes in the environ- dards during construction helps achieve a proj-
ments in which software operates also affect soft- ect’s objectives for efficiency, quality, and cost.
ware in diverse ways. Specifically, the choices of allowable program-
Anticipating change helps software engineers ming language subsets and usage standards are
build extensible software, which means they can important aids in achieving higher security.
enhance a software product without disrupting Standards that directly affect construction
the underlying structure. issues include
Anticipating change is supported by many spe-
cific techniques (see section 3.3, Coding). • communication methods (for example, stan-
dards for document formats and contents)
1.3. Constructing for Verification • programming languages (for example, lan-
[1*] guage standards for languages like Java and
C++)
Constructing for verification means building • coding standards (for example, standards for
software in such a way that faults can be read- naming conventions, layout, and indentation)
ily found by the software engineers writing the • platforms (for example, interface standards
software as well as by the testers and users during for operating system calls)
3-4 SWEBOK® Guide V3.0
• tools (for example, diagrammatic standards the Software Management and Software Process
for notations like UML (Unified Modeling KAs).
Language)). Consequently, what is considered to be “con-
struction” depends to some degree on the life
Use of external standards. Construction cycle model used. In general, software con-
depends on the use of external standards for con- struction is mostly coding and debugging, but
struction languages, construction tools, technical it also involves construction planning, detailed
interfaces, and interactions between the Software design, unit testing, integration testing, and other
Construction KA and other KAs. Standards come activities.
from numerous sources, including hardware and
software interface specifications (such as the 2.2. Construction Planning
Object Management Group (OMG)) and interna- [1*]
tional organizations (such as the IEEE or ISO).
Use of internal standards. Standards may also The choice of construction method is a key aspect
be created on an organizational basis at the cor- of the construction-planning activity. The choice
porate level or for use on specific projects. These of construction method affects the extent to
standards support coordination of group activi- which construction prerequisites are performed,
ties, minimizing complexity, anticipating change, the order in which they are performed, and the
and constructing for verification. degree to which they should be completed before
construction work begins.
2. Managing Construction The approach to construction affects the proj-
ect team’s ability to reduce complexity, anticipate
2.1. Construction in Life Cycle Models change, and construct for verification. Each of
[1*] these objectives may also be addressed at the pro-
cess, requirements, and design levels—but they
Numerous models have been created to develop will be influenced by the choice of construction
software; some emphasize construction more method.
than others. Construction planning also defines the order
Some models are more linear from the con- in which components are created and integrated,
struction point of view—such as the waterfall and the integration strategy (for example, phased or
staged-delivery life cycle models. These models incremental integration), the software quality
treat construction as an activity that occurs only management processes, the allocation of task
after significant prerequisite work has been com- assignments to specific software engineers, and
pleted—including detailed requirements work, other tasks, according to the chosen method.
extensive design work, and detailed planning.
The more linear approaches tend to emphasize 2.3. Construction Measurement
the activities that precede construction (require- [1*]
ments and design) and to create more distinct sep-
arations between activities. In these models, the Numerous construction activities and artifacts can
main emphasis of construction may be coding. be measured—including code developed, code
Other models are more iterative—such as modified, code reused, code destroyed, code com-
evolutionary prototyping and agile develop- plexity, code inspection statistics, fault-fix and
ment. These approaches tend to treat construc- fault-find rates, effort, and scheduling. These mea-
tion as an activity that occurs concurrently with surements can be useful for purposes of managing
other software development activities (including construction, ensuring quality during construction,
requirements, design, and planning) or that over- and improving the construction process, among
laps them. These approaches tend to mix design, other uses (see the Software Engineering Process
coding, and testing activities, and they often treat KA for more on measurement).
the combination of activities as construction (see
Software Construction 3-5
• Variability implementation with mecha- • unit testing and integration testing (see sec-
nisms such as parameterization, conditional tion 3.4, Construction Testing)
compilation, design patterns, and so forth. • test-first development (see section 2.2 in the
• Variability encapsulation to make the soft- Software Testing KA)
ware assets easy to configure and customize. • use of assertions and defensive programming
• Testing the variability provided by the reus- • debugging
able software assets. • inspections
• Description and publication of reusable soft- • technical reviews, including security-ori-
ware assets. ented reviews (see section 2.3.2 in the Soft-
ware Quality KA)
3.6. Construction with Reuse • static analysis (see section 2.3 of the Soft-
[2*] ware Quality KA)
Construction with reuse means to create new The specific technique or techniques selected
software with the reuse of existing software depend on the nature of the software being con-
assets. The most popular method of reuse is to structed as well as on the skillset of the software
reuse code from the libraries provided by the lan- engineers performing the construction activi-
guage, platform, tools being used, or an organiza- ties. Programmers should know good practices
tional repository. Asides from these, the applica- and common vulnerabilities—for example, from
tions developed today widely make use of many widely recognized lists about common vulner-
open-source libraries. Reused and off-the-shelf abilities. Automated static analysis of code for
software often have the same—or better—quality security weaknesses is available for several com-
requirements as newly developed software (for mon programming languages and can be used in
example, security level). security-critical projects.
The tasks related to software construction with Construction quality activities are differenti-
reuse during coding and testing are as follows: ated from other quality activities by their focus.
Construction quality activities focus on code and
• The selection of the reusable units, data- artifacts that are closely related to code—such
bases, test procedures, or test data. as detailed design—as opposed to other artifacts
• The evaluation of code or test reusability. that are less directly connected to the code, such
• The integration of reusable software assets as requirements, high-level designs, and plans.
into the current software.
• The reporting of reuse information on new 3.8. Integration
code, test procedures, or test data. [1*]
determining points in the project at which interim 4.2. Object-Oriented Runtime Issues
versions of the software are tested. [1*]
Programs can be integrated by means of either
the phased or the incremental approach. Phased Object-oriented languages support a series of
integration, also called “big bang” integration, runtime mechanisms including polymorphism
entails delaying the integration of component and reflection. These runtime mechanisms
software parts until all parts intended for release increase the flexibility and adaptability of object-
in a version are complete. Incremental integration oriented programs. Polymorphism is the ability
is thought to offer many advantages over the tra- of a language to support general operations with-
ditional phased integration—for example, easier out knowing until runtime what kind of concrete
error location, improved progress monitoring, objects the software will include. Because the
earlier product delivery, and improved customer program does not know the exact types of the
relations. In incremental integration, the develop- objects in advance, the exact behaviour is deter-
ers write and test a program in small pieces and mined at runtime (called dynamic binding).
then combine the pieces one at a time. Additional Reflection is the ability of a program to observe
test infrastructure, such as stubs, drivers, and and modify its own structure and behavior at run-
mock objects, are usually needed to enable incre- time. Reflection allows inspection of classes,
mental integration. By building and integrating interfaces, fields, and methods at runtime with-
one unit at a time (for example, a class or compo- out knowing their names at compile time. It also
nent), the construction process can provide early allows instantiation at runtime of new objects and
feedback to developers and customers. Other invocation of methods using parameterized class
advantages of incremental integration include and method names.
easier error location, improved progress monitor-
ing, more fully tested units, and so forth. 4.3. Parameterization and Generics
[4*]
4. Construction Technologies
Parameterized types, also known as generics
4.1. API Design and Use (Ada, Eiffel) and templates (C++), enable the
[3*] definition of a type or class without specifying all
the other types it uses. The unspecified types are
An application programming interface (API) is the supplied as parameters at the point of use. Param-
set of signatures that are exported and available to eterized types provide a third way (in addition to
the users of a library or a framework to write their class inheritance and object composition) to com-
applications. Besides signatures, an API should pose behaviors in object-oriented software.
always include statements about the program’s
effects and/or behaviors (i.e., its semantics). 4.4. Assertions, Design by Contract, and Defensive
API design should try to make the API easy Programming
to learn and memorize, lead to readable code, be [1*]
hard to misuse, be easy to extend, be complete,
and maintain backward compatibility. As the An assertion is an executable predicate that’s
APIs usually outlast their implementations for placed in a program—usually a routine or macro—
a widely used library or framework, it is desired that allows runtime checks of the program. Asser-
that the API be straightforward and kept stable to tions are especially useful in high-reliability pro-
facilitate the development and maintenance of the grams. They enable programmers to more quickly
client applications. flush out mismatched interface assumptions, errors
API use involves the processes of select- that creep in when code is modified, and so on.
ing, learning, testing, integrating, and possibly Assertions are normally compiled into the code at
extending APIs provided by a library or frame- development time and are later compiled out of the
work (see section 3.6, Construction with Reuse). code so that they don’t degrade the performance.
Software Construction 3-9
Design by contract is a development approach or containing their effects if recovery is not pos-
in which preconditions and postconditions are sible. The most common fault tolerance strategies
included for each routine. When preconditions include backing up and retrying, using auxiliary
and postconditions are used, each routine or code, using voting algorithms, and replacing an
class is said to form a contract with the rest of erroneous value with a phony value that will have
the program. Furthermore, a contract provides a a benign effect.
precise specification of the semantics of a routine,
and thus helps the understanding of its behavior. 4.6. Executable Models
Design by contract is thought to improve the [5*]
quality of software construction.
Defensive programming means to protect a Executable models abstract away the details of
routine from being broken by invalid inputs. specific programming languages and decisions
Common ways to handle invalid inputs include about the organization of the software. Different
checking the values of all the input parameters from traditional software models, a specification
and deciding how to handle bad inputs. Asser- built in an executable modeling language like
tions are often used in defensive programming to xUML (executable UML) can be deployed in
check input values. various software environments without change.
An executable-model compiler (transformer) can
4.5. Error Handling, Exception Handling, and turn an executable model into an implementation
Fault Tolerance using a set of decisions about the target hardware
[1*] and software environment. Thus, constructing
executable models can be regarded as a way of
The way that errors are handled affects software’s constructing executable software.
ability to meet requirements related to correct- Executable models are one foundation support-
ness, robustness, and other nonfunctional attri- ing the Model-Driven Architecture (MDA) initia-
butes. Assertions are sometimes used to check tive of the Object Management Group (OMG). An
for errors. Other error handling techniques—such executable model is a way to completely specify
as returning a neutral value, substituting the next a Platform Independent Model (PIM); a PIM is
piece of valid data, logging a warning message, a model of a solution to a problem that does not
returning an error code, or shutting down the soft- rely on any implementation technologies. Then
ware—are also used. a Platform Specific Model (PSM), which is a
Exceptions are used to detect and process model that contains the details of the implemen-
errors or exceptional events. The basic structure tation, can be produced by weaving together the
of an exception is that a routine uses throw to PIM and the platform on which it relies.
throw a detected exception and an exception han-
dling block will catch the exception in a try-catch 4.7. State-Based and Table-Driven Construction
block. The try-catch block may process the erro- Techniques
neous condition in the routine or it may return [1*]
control to the calling routine. Exception handling
policies should be carefully designed follow- State-based programming, or automata-based
ing common principles such as including in the programming, is a programming technology
exception message all information that led to the using finite state machines to describe program
exception, avoiding empty catch blocks, knowing behaviours. The transition graphs of a state
the exceptions the library code throws, perhaps machine are used in all stages of software devel-
building a centralized exception reporter, and opment (specification, implementation, debug-
standardizing the program’s use of exceptions. ging, and documentation). The main idea is to
Fault tolerance is a collection of techniques construct computer programs the same way the
that increase software reliability by detecting automation of technological processes is done.
errors and then recovering from them if possible State-based programming is usually combined
3-10 SWEBOK® Guide V3.0
[7*]
[5*]
[3*]
[2*]
[4*]
[6*]
[1*]
1. Software
Construction
Fundamentals
c2, c3,
c7-c9,
1.1. Minimizing
c24, c27,
Complexity
c28, c31,
c32, c34
c3–c5,
1.2. Anticipating
c24, c31,
Change
c32, c34
c8,
1.3. Constructing for c20–
Verification c23, c31,
c34
1.4. Reuse c16
1.5. Standards in
c4
Construction
2. Managing
Construction
2.1. Construction in c2, c3,
Life Cycle Models c27, c29
c3, c4,
2.2. Construction
c21,
Planning
c27–c29
2.3. Construction
c25, c28
Measurement
3. Practical
Considerations
3.1. Construction c3, c5,
Design c24
3.2. Construction
c4
Languages
c5–c19,
3.3. Coding
c25–c26
3-14 SWEBOK® Guide V3.0
[7*]
[5*]
[3*]
[2*]
[4*]
[6*]
[1*]
3.4. Construction
c22, c23
Testing
3.5. Construction for
c16
Reuse
3.6. Construction
c16
with Reuse
3.7. Construction c8,
Quality c20–c25
3.8. Integration c29
4. Construction
Technologies
4.1. API Design and
c7
Use
4.2. Object-Oriented
c6, c7
Runtime Issues
4.3.
Parameterization c1
and Generics
4.4. Assertions,
Design by Contract,
c8, c9
and Defensive
Programming
4.5. Error Handling,
Exception Handling, c3, c8
and Fault Tolerance
4.6. Executable
c1
Models
4.7. State-Based
and Table-Driven
c18
Construction
Techniques
4.8. Runtime
Configuration and c3, c10
Internationalization
4.9. Grammar-Based
c5 c8
Input Processing
Software Construction 3-15
[7*]
[5*]
[3*]
[2*]
[4*]
[6*]
4.10. Concurrency [1*]
c6
Primitives
4.11. Middleware c1 c8
4.12. Construction
Methods for c2
Distributed Software
4.13. Constructing
Heterogeneous c9
Systems
4.14. Performance
c25, c26
Analysis and Tuning
4.15. Platform
c10 c1
Standards
4.16. Test-First
c22
Programming
5. Construction Tools
5.1. Development
c30
Environments
5.2. GUI Builders c30
5.3. Unit Testing
c22 c8
Tools
5.4. Profiling,
Performance
c25, c26
Analysis, and
Slicing Tools
3-16 SWEBOK® Guide V3.0
IEEE Std. 1517-2010 Standard for Information [1*] S. McConnell, Code Complete, 2nd ed.,
Technology—System and Software Life Microsoft Press, 2004.
Cycle Processes—Reuse Processes, IEEE,
2010 [8]. [2*] I. Sommerville, Software Engineering, 9th
ed., Addison-Wesley, 2011.
This standard specifies the processes, activities,
and tasks to be applied during each phase of the [3*] P. Clements et al., Documenting Software
software life cycle to enable a software product Architectures: Views and Beyond, 2nd ed.,
to be constructed from reusable assets. It covers Pearson Education, 2010.
the concept of reuse-based development and the
processes of construction for reuse and construc- [4*] E. Gamma et al., Design Patterns: Elements
tion with reuse. of Reusable Object-Oriented Software, 1st
ed., Addison-Wesley Professional, 1994.
IEEE Std. 12207-2008 (a.k.a. ISO/IEC
12207:2008) Standard for Systems and [5*] S.J. Mellor and M.J. Balcer, Executable
Software Engineering—Software Life Cycle UML: A Foundation for Model-Driven
Processes, IEEE, 2008 [9]. Architecture, 1st ed., Addison-Wesley,
2002.
This standard defines a series of software devel-
opment processes, including software construc- [6*] L. Null and J. Lobur, The Essentials of
tion process, software integration process, and Computer Organization and Architecture,
software reuse process. 2nd ed., Jones and Bartlett Publishers,
2006.