Software Construction
Chapter 4: Software Construction
Section titled “Chapter 4: Software Construction”Acronyms
Section titled “Acronyms”| Acronym | Full Form | 
|---|---|
| API | Application Programming Interface | 
| ASIC | Application-Specific Integrated Circuit | 
| BaaS | Backend as a Service | 
| CI | Continuous Integration | 
| COTS | Commercial Off-The-Shelf | 
| CSS | Cascading Style Sheets | 
| DSL | Domain-Specific Language | 
| DSP | Digital Signal Processor | 
| ESB | Enterprise Service Bus | 
| FPGA | Field Programmable Gate Array | 
| GPU | Graphic Processing Unit | 
| GUI | Graphical User Interface | 
| HTML5 | Hypertext Markup Language Version 5 | 
| IDE | Integrated Development Environment | 
| IEEE | Institute of Electrical and Electronics Engineers | 
| ISO | International Organization for Standardization | 
| JEE | Jakarta Enterprise Edition | 
| KA | Knowledge Area | 
| MDA | Model-Driven Architecture | 
| NPM | Node Package Manager | 
| OMG | Object Management Group | 
| PIM | Platform Independent Model | 
| POSIX | Portable Operating System Interface | 
| PSM | Platform-Specific Model | 
| SDK | Software Development Kit | 
| TDD | Test-Driven Development | 
| UML | Unified Modeling Language | 
| WYSIWYG | What You See Is What You Get | 
Introduction
Section titled “Introduction”Software construction refers to the detailed creation of working software through a combination of coding, verification, unit testing, integration testing, and debugging.
This Knowledge Area (KA) is deeply connected to all other KAs but has the strongest links with Software Design and Software Testing. The construction process takes outputs from design and produces inputs for testing. However, the boundaries between these activities are flexible and depend on the software life cycle model. Much of the detailed design work actually occurs during construction, and software engineers constantly perform unit and integration testing on their own work.
Software construction is also related to:
- Software Configuration Management, as it produces the largest number of configuration items (source files, test cases, etc.).
 - Software Quality, as the code produced during construction is the ultimate deliverable.
 - Software Engineering Management, as construction produces the most deliverables.
 - Computing Foundations, as it requires knowledge of algorithms and coding practices.
 
Breakdown of Topics for Software Construction
Section titled “Breakdown of Topics for Software Construction”- Software Construction Fundamentals
 - Managing Construction
 - Practical Considerations
 - Construction Technologies
 - Software Construction Tools
 
1. Software Construction Fundamentals
Section titled “1. Software Construction Fundamentals”Fundamental concepts that apply to both design and construction.
1.1 Minimizing Complexity
Section titled “1.1 Minimizing Complexity”Most people have a limited capacity to hold complex information in their working memory. A primary goal of software construction is to minimize complexity to make code easier to understand and verify. This is achieved by writing simple, readable code rather than overly clever code, using standards, and employing modular design. Tools can help manage complexity; for instance, cyclomatic complexity is a measure of how difficult code is to test, while IDEs help manage the complexity of the development process itself.
1.2 Anticipating and Embracing Change
Section titled “1.2 Anticipating and Embracing Change”Software and its operational environment inevitably change over time. Anticipating change helps engineers build extensible software that can evolve without disrupting its core structure. In modern business, this means embracing change by adopting agile development, DevOps, and continuous delivery/deployment practices to align the development process with an evolutionary environment.
1.3 Constructing for Verification
Section titled “1.3 Constructing for Verification”This involves building software so that faults can be easily found by developers, testers, and users. Techniques include following coding standards to support code reviews, organizing code for automated testing, restricting complex language structures, and logging software behavior.
1.4 Reusing Assets
Section titled “1.4 Reusing Assets”Reuse involves using existing assets (frameworks, libraries, components, code) to solve new problems. This has two facets:
- Construction for reuse: Creating new, reusable software assets.
 - Construction with reuse: Using existing assets to build a new solution.
 
1.5 Applying Standards in Construction
Section titled “1.5 Applying Standards in Construction”Using standards helps achieve project objectives for efficiency, quality, cost, and security. Standards can be external (from bodies like IEEE or ISO for languages and tools) or internal (created by an organization for a specific project). They cover areas like:
- Communication methods (e.g., document formats)
 - Programming languages and coding conventions
 - Platforms and tools (e.g., UML for notation)
 
2. Managing Construction
Section titled “2. Managing Construction”2.1 Construction in Life Cycle Models
Section titled “2.1 Construction in Life Cycle Models”The role of construction varies depending on the life cycle model:
- Linear models (e.g., Waterfall) treat construction as a distinct phase that occurs after requirements and design are complete. The main emphasis is on coding.
 - Iterative models (e.g., agile development) overlap construction with other activities like design and testing.
 - Continuous delivery/deployment practices further mix coding, testing, and deployment into a fully automated pipeline.
 
Ultimately, construction is primarily coding and debugging, but it can also include detailed design, unit testing, and integration testing.
2.2 Construction Planning
Section titled “2.2 Construction Planning”This activity involves choosing a construction method, which affects the order and prerequisites of tasks. Planning also defines the integration strategy, quality management processes, and task assignments.
2.3 Construction Measurement
Section titled “2.3 Construction Measurement”Many artifacts and activities can be measured, including code developed, code complexity, code inspection statistics, and fault-find rates. These metrics are useful for managing the construction process and ensuring quality.
2.4 Managing Dependencies
Section titled “2.4 Managing Dependencies”Modern software relies heavily on internal and external (open-source) dependencies. These dependencies form a supply chain network that can introduce risks (e.g., defects, vulnerabilities, license conflicts). Dependencies must be carefully managed, and unnecessary ones should be avoided.
3. Practical Considerations
Section titled “3. Practical Considerations”Construction is often driven by real-world constraints, making it one of the most craft-like activities in software engineering.
3.1 Construction Design
Section titled “3.1 Construction Design”Regardless of the life cycle, some detailed design work always occurs during construction. This involves making small-scale design decisions about algorithms, data structures, and interfaces to flesh out the higher-level design.
3.2 Construction Languages
Section titled “3.2 Construction Languages”These are any form of communication a human can use to specify an executable solution. They range from simple configuration languages to complex programming languages. The choice of language can significantly impact quality attributes like performance, reliability, and security.
Types of languages include:
- Configuration languages: Choose from a limited set of predefined options.
 - Toolkit languages: Build applications from reusable parts in a toolkit.
 - Scripting languages: Common application programming languages (e.g., batch files, macros).
 - Programming languages: The most flexible type, requiring the most skill. They use different notations:
- Linguistic: Textual strings with sentence-like syntax (e.g., $C/C++, Java$).
 - Formal: Precise, unambiguous notations with mathematical definitions.
 - Visual: Use the placement of visual entities (icons) to represent software.
 
 - Domain-Specific Languages (DSLs): Designed for building applications in a particular domain, often at a higher level of abstraction.
 
3.3 Coding
Section titled “3.3 Coding”Key considerations during coding include:
- Creating understandable code through naming and layout conventions.
 - Proper use of classes, variables, and constants.
 - Handling of error conditions and preventing security breaches (e.g., buffer overflows).
 - Managing resources like threads and database locks.
 - Organizing source code into logical structures.
 - Documenting and tuning code.
 
3.4 Construction Testing
Section titled “3.4 Construction Testing”This involves unit testing and integration testing, typically performed by the engineer who wrote the code. The goal is to reduce the time between when a fault is introduced and when it is detected, lowering the cost of fixing it.
3.5 Reuse in Construction
Section titled “3.5 Reuse in Construction”This involves both creating reusable assets (construction for reuse) and using them (construction with reuse).
- For Reuse: Encapsulate reusable code into well-structured libraries or components and implement variability through mechanisms like parameterization and design patterns.
 - With Reuse: Select and integrate existing software assets, including open-source libraries and cloud services (e.g., BaaS).
 
Systematic reuse, supported by frameworks and product line engineering, can significantly improve productivity and quality.
3.6 Construction Quality
Section titled “3.6 Construction Quality”Techniques to ensure code quality include:
- Unit and integration testing.
 - Test-first development.
 - Assertions and defensive programming.
 - Debugging.
 - Inspections and technical reviews.
 - Static analysis.
 
These activities focus on artifacts closely related to the code, such as detailed design.
3.7 Integration
Section titled “3.7 Integration”A key activity is combining individually developed components into a single system.
- Phased (Big Bang) Integration: Delays integration until all parts are complete. This approach makes error location difficult.
 - Incremental Integration: Combines and tests pieces one at a time. This provides early feedback, improves progress monitoring, and makes errors easier to find.
 - Continuous Integration (CI): A modern practice where the team integrates work frequently (multiple times a day), with each integration being automatically built and tested by a pipeline.
 
3.8 Cross-Platform Development and Migration
Section titled “3.8 Cross-Platform Development and Migration”Many applications must support multiple platforms (e.g., iOS, Android).
- Cross-platform development allows developers to use a universal language and export it to various platforms, either by compiling to native formats or by creating hybrid web applications.
 - Migration involves translating an existing application from one platform to another, a process that can be partially automated.
 
4. Construction Technologies
Section titled “4. Construction Technologies”4.1 API Design and Use
Section titled “4.1 API Design and Use”An Application Programming Interface (API) is a set of signatures and semantic statements that a library or framework exports for users. A good API should be easy to learn, use, and extend, while also being stable and difficult to misuse.
4.2 Object-Oriented Runtime Issues
Section titled “4.2 Object-Oriented Runtime Issues”Object-oriented languages support runtime mechanisms that increase flexibility:
- Polymorphism: The ability to support general operations without knowing an object’s concrete type until runtime.
 - Reflection: A program’s ability to observe and modify its own structure and behavior at runtime.
 
4.3 Parameterization, Templates, and Generics
Section titled “4.3 Parameterization, Templates, and Generics”These features (known as generics in Java or templates in C++) allow a class to be defined without specifying all the types it uses. These unspecified types are supplied as parameters when the class is used.
4.4 Assertions, Design by Contract, and Defensive Programming
Section titled “4.4 Assertions, Design by Contract, and Defensive Programming”- Assertion: An executable predicate placed in a program to check for conditions at runtime.
 - Design by Contract: A development approach where each routine includes preconditions and postconditions, forming a “contract” with the rest of the program.
 - Defensive Programming: Protecting a routine from being broken by invalid inputs, often by checking input parameter values.
 
4.5 Error Handling, Exception Handling, and Fault Tolerance
Section titled “4.5 Error Handling, Exception Handling, and Fault Tolerance”- Error Handling: Techniques to manage errors, such as returning an error code or logging a message.
 - Exception Handling: A mechanism to detect and process errors or exceptional events using 
try-catchblocks. - Fault Tolerance: Techniques that increase reliability by detecting errors and recovering from them (e.g., retrying, using auxiliary code).
 
4.6 Executable Models
Section titled “4.6 Executable Models”An executable model (e.g., using xUML) is an abstract specification that can be compiled into an implementation for a specific target environment. This is a core concept in the OMG’s Model-Driven Architecture (MDA) initiative.
4.7 State-Based and Table-Driven Construction
Section titled “4.7 State-Based and Table-Driven Construction”- State-Based Programming: Uses finite-state machines to describe program behavior.
 - Table-Driven Methods: Use tables to look up information rather than using logic statements (like 
iforcase). This can simplify code and make it easier to modify. 
4.8 Runtime Configuration and Internationalization
Section titled “4.8 Runtime Configuration and Internationalization”- Runtime Configuration: Binds variable values and settings while the program is running, often by reading configuration files.
 - Internationalization: The process of preparing software to support multiple locales, which involves managing strings, character sets, and translations.
 
4.9 Grammar-Based Input Processing
Section titled “4.9 Grammar-Based Input Processing”This involves parsing an input stream by creating a data structure like a parse tree, which represents the input’s syntax.
4.10 Concurrency Primitives
Section titled “4.10 Concurrency Primitives”These are abstractions provided by a language or OS to manage concurrent access to shared resources. Examples include semaphores, monitors, and mutexes.
4.11 Middleware
Section titled “4.11 Middleware”Software that provides services above the operating system layer but below the application layer. It acts as a connector between components, providing services like message passing, persistence, and location transparency. An Enterprise Service Bus (ESB) is a form of message-oriented middleware.
4.12 Construction Methods for Distributed and Cloud-Based Software
Section titled “4.12 Construction Methods for Distributed and Cloud-Based Software”Distributed software construction deals with issues like parallelism, communication, and fault tolerance. Cloud-based software often uses microservice architectures and container-based deployment, requiring developers to consider cloud infrastructure issues like API gateways and service discovery.
4.13 Constructing Heterogeneous Systems
Section titled “4.13 Constructing Heterogeneous Systems”These systems consist of various specialized computational units (e.g., GPUs, DSPs, FPGAs). Their construction may involve hardware/software codesign, where software development and virtual hardware simulation proceed concurrently.
4.14 Performance Analysis and Tuning
Section titled “4.14 Performance Analysis and Tuning”Performance analysis uses tools to gather information about a program’s behavior to identify hot spots. Code tuning involves making small modifications to correct code to improve its efficiency (e.g., optimizing loops or logic expressions).
4.15 Platform Standards
Section titled “4.15 Platform Standards”Standards like Jakarta Enterprise Edition (JEE) and POSIX enable programmers to develop portable applications that can run in different compatible environments without changes.
4.16 Test-First Programming
Section titled “4.16 Test-First Programming”Also known as Test-Driven Development (TDD), this is a style where failing test cases are written before the functional code. Code is then written to make the tests pass. This practice helps detect defects earlier and forces developers to think about requirements before coding.
4.17 Feedback Loop for Construction
Section titled “4.17 Feedback Loop for Construction”Agile development and DevOps emphasize early and continuous feedback. Agile provides feedback through frequent iterations, while DevOps provides even faster feedback from the production environment through automated pipelines, canary releases, and A/B testing.
5. Software Construction Tools
Section titled “5. Software Construction Tools”5.1 Development Environments
Section titled “5.1 Development Environments”An Integrated Development Environment (IDE) provides comprehensive facilities for software construction. Modern IDEs offer code editing, compilation, debugging, version control integration, refactoring support, and AI-assisted programming features powered by Large Language Models (LLMs).
5.2 Visual Programming and Low-Code/Zero-Code Platforms
Section titled “5.2 Visual Programming and Low-Code/Zero-Code Platforms”- Visual Programming: Allows users to create programs by graphically manipulating program elements. GUI builders are a common example, enabling WYSIWYG development of user interfaces.
 - Low-Code/Zero-Code Platforms: Evolved from these tools, they allow developers to build complete applications visually via a drag-and-drop interface with minimal (low-code) or no (zero-code) hand-coding.
 
5.3 Unit Testing Tools
Section titled “5.3 Unit Testing Tools”These tools and frameworks help developers automate the process of unit testing. They allow developers to code criteria into tests, run them automatically, and receive reports on any failures.
5.4 Profiling, Performance Analysis, and Slicing Tools
Section titled “5.4 Profiling, Performance Analysis, and Slicing Tools”- Profiling Tools: Monitor code as it runs to record how much time is spent in different parts of the program, helping to identify performance hot spots.
 - Program Slicing Tools: Compute the set of program statements (a slice) that might affect a variable’s value at a certain point. This is useful for debugging and optimization.