CSCI 0299: C++ for Engineers - Lecture 1 Preliminaries Flashcards
Software Engineering and Software Development Life Cycle
Computer Program (Software): A self-contained set of instructions used to operate a computer to produce a specific result. It is a solution developed to solve a particular problem, written in a form that can be executed on a computer.
Software Development Procedure: A systematic process that helps developers thoroughly understand the problem to be solved and construct an effective, appropriate software solution.
Software Engineering: A discipline focused on creating readable, efficient, reliable, and maintainable software programs and systems. It utilizes the software development procedure to accomplish these operational goals.
Three Phases of Program Development:
Phase I: Development and Design
Phase II: Documentation
Phase III: Maintenance
Phase I: Development and Design
Program Requirement: A formal request for a program or an explicit statement describing a problem. The receipt of a program requirement triggers the start of Phase I.
Step 1: Analyze the Problem:
Determine and understand the exact output items the program must produce.
Determine the required input items.
Together, these inputs and outputs are referred to as the problem's Input/Output (I/O).
Step 2: Develop a Solution:
Select the exact sequence of steps, termed an algorithm, to solve the problem.
Refine the algorithm iteratively, beginning with the initial solution outlined in the analysis step until an acceptable and complete solution is defined.
Thoroughly check the proposed solution for functional correctness.
Structure Diagrams:
First-Level Structure Diagram: Illustrates top-level functional modules (e.g., high-level components of an inventory tracking system).
Second-Level Structure Diagram: Illustrates further refinements and detailed sub-components of the initial top-level modules.
Step 3: Code the Solution:
Involves writing the actual C++ program code corresponding directly to the algorithm designed in Step 2.
Software implementations must incorporate well-defined patterns or control structures:
Sequence: Specifies the precise order in which instructions are executed.
Selection: Enables branching between different execution paths based on the evaluation of a condition.
Iteration: Allows the repetition of identical operations or instruction blocks based on a condition (commonly called looping or repetition).
Invocation: Involves invoking or calling a designated set of statements whenever needed.
Step 4: Test and Correct the Program:
Testing: A structured methodology used to verify program correctness and confirm that all initial requirements are satisfied.
Bug: Any error or flaw in a computer program.
Debugging: The multi-step process of locating an error, applying a correction, and verifying that the correction resolves the issue without introducing new errors.
Testing Guarantee: Testing can demonstrate the presence of bugs, but it can never guarantee the absolute absence of errors.
Effort Allocation: In large commercial projects, software design and development steps require significant time and effort, with major portions allocated to upfront analysis, structural design, systematic coding, and rigorous testing.
Phase II: Documentation
Documentation Artifacts: Every completed problem solution must include five primary, distinct documents:
Program description
Algorithm development and record of changes
Well-commented program listing
Sample test runs
Users' manual
Phase III: Maintenance and Backup Procedures
Phase III: Maintenance:
Encompasses ongoing correction of newly discovered bugs over time.
Includes code revisions made to accommodate changing user requirements.
Involves adding new features and updated operational functionalities.
Maintenance is typically the longest phase in the software life cycle and often serves as a primary source of recurring revenue for software companies.
Well-written code and comprehensive Phase II documentation are vital for effective maintenance.
Backup Procedures:
The operational practice of creating exact duplicate copies of program source code and documentation on a regular schedule.
Serves as insurance against data loss or system failure.
Storing backup copies at off-site locations provides additional protection against physical disaster.
Algorithms and Flowcharts
Algorithm: A step-by-step sequence of instructions detailing how data is to be processed to generate a desired output. An algorithm must terminate.
Representation Formats for Algorithms:
Pseudocode: English-like descriptive phrases used to outline steps in an algorithm.
Formula: Mathematical equations representing processing logic.
Flowchart: Graphical diagrams using standardized geometric symbols connected by directional lines.
Sample Problem: Calculate the sum of all whole numbers from through .
Standard Flowchart Symbols:
Terminal: Oval shape indicating the start or end point of a program.
Input/Output: Parallelogram indicating reading inputs or writing outputs.
Process: Rectangle indicating arithmetic computations or data manipulation.
Flow Lines: Arrows connecting flowchart symbols that specify logic execution order.
Decision: Diamond shape specifying a conditional evaluation point where the execution path branches.
Loop: Symbol specifying the initial, limit, and increment values of an iterative loop construct.
Predefined Process: Symbol specifying execution of a predefined module or function call.
Connector: Symbol indicating entry to or exit from another section of the flowchart.
Report: Symbol specifying a written or printed output report.
Example Flowchart Execution (Average of Three Numbers):
Step 1: Start (Terminal symbol)
Step 2: Input three values (Input/Output symbol)
Step 3: Calculate the average (Process symbol)
Step 4: Display the average (Input/Output symbol)
Step 5: End (Terminal symbol)
Software Classifications and Programming Languages
Programming: The process of creating software instructions.
Programming Language: A defined syntax and instruction set used to build computer programs.
Machine Language:
The only language that a computer can natively execute.
Also referred to as executable programs or executables.
Composed entirely of sequences of binary numbers (s and s).
Machine instructions consist of two parts: an instruction code (opcode) and an address.
Assembly Language:
Replaces binary opcodes with word-like symbolic mnemonics such as
ADD,SUB, andMUL.Uses decimal numbers and readable labels for memory addresses (e.g.,
ADD 1, 2).Requires translation into machine code via an Assembler.
Language Abstraction Levels:
Low-Level Languages: Languages whose instructions are tied directly to one specific type of computer hardware (e.g., machine language, assembly language).
High-Level Languages: Instructions resemble written natural languages like English and can be executed across diverse hardware platforms (e.g., Visual Basic, C, C++, Java).
Source Code Translation:
Source Code: Program code written in high-level or low-level human-readable languages.
Interpreter: Translates source code one statement at a time, executing each instruction immediately after translation.
Compiler: Translates all program statements at once into an executable program (object program) that is stored for execution at a later time.
C++ is predominantly a compiled language.
Programming Paradigms:
Procedural: Code is structured into modular, self-contained instruction blocks called procedures or functions (e.g., FORTRAN, ALGOL, COBOL, BASIC, Pascal, C).
Object-Oriented: Code organizes software around reusable units called objects that combine data and function methods.
C++ contains features of both procedural and object-oriented programming.
Software Types:
Application Software: Programs designed to carry out specific end-user tasks.
System Software: The set of control programs operating computer hardware.
Booting: Loading system software into primary memory upon system start up.
Bootstrap Loader: A permanent, automatically executed system component that initiates the boot sequence.
Operating System (OS): The comprehensive suite of system programs managing:
Memory allocation
CPU time scheduling
Input and output device control
Secondary storage device management
Multi-User System: Supports simultaneous program execution by multiple users.
Multitasking System (Multiprogrammed System): Supports simultaneous execution of multiple programs for a single user.
Computer Hardware and Storage
Hardware Components:
Arithmetic and Logic Unit (ALU): Performs all arithmetic calculations and logical comparisons.
Control Unit: Monitors, regulates, and directs internal hardware operations.
Central Processing Unit (CPU) / Microprocessor: Combines the ALU and Control Unit on a single integrated chip.
Memory Unit: Stores current program instructions and active operational data.
Input/Output (I/O) Unit: Manages hardware interfaces to external peripheral equipment.
Secondary Storage: Provides permanent, nonvolatile storage (e.g., magnetic hard disk drives).
Computer Storage Concepts:
Bit: The primary atomic unit of data, holding a value of or .
Byte: A grouping of bits representing a single distinct character.
Character Codes: Defined binary pattern mappings used to encode textual characters (e.g., ASCII, EBCDIC).
Number Codes / Two's Complement: System used to encode positive and negative integers into binary string representations using value boxes. Example conversion: Binary to base representation.
Word: A grouping of one or more bytes processed together as a unit to maximize data access speeds. The word size dictates the hardware limits for minimum and maximum storable integer values.
Common Programming Errors
Writing and executing code immediately before fully analyzing and understanding problem specifications.
Failing to implement routine, systematic source code and documentation backups.
Failing to realize that computers follow explicitly written algorithms and cannot infer logical intent.
Here are the flashcards in Q&A format:
Q: What is a Computer Program (Software)?
A: A self-contained set of instructions used to operate a computer to produce a specific result.Q: What is a Software Development Procedure?
A: A systematic process that helps developers understand the problem and construct an effective software solution.Q: What is Software Engineering?
A: A discipline focused on creating readable, efficient, reliable, and maintainable software programs and systems.Q: What does Development and Design refer to?
A: The first phase of program development which involves analyzing the problem, developing a solution, and coding it.Q: What is a Program Requirement?
A: A formal request for a program or an explicit statement describing a problem.Q: What is an Algorithm?
A: A step-by-step sequence of instructions detailing how data is to be processed to generate a desired output.Q: What is Documentation?
A: The process of creating required documents that describe the program and its functionalities.Q: What does Maintenance involve?
A: Ongoing correction of newly discovered bugs and adaptations to changing user requirements.Q: What are Backup Procedures?
A: Creating exact duplicate copies of program source code and documentation on a regular schedule.Q: What is Machine Language?
A: The only language that a computer can natively execute, composed entirely of binary numbers.Q: What is Assembly Language?
A: Uses symbolic mnemonics to replace binary opcodes and is translated into machine code.Q: What is a High-Level Language?
A: Languages that resemble written natural languages and can be executed across diverse hardware platforms.Q: What is a Compiler?
A: Translates all program statements at once into an executable program.Q: What is a Debugger?
A: A tool or process for locating and correcting bugs in a computer program.Q: What is System Software?
A: The set of control programs operating computer hardware.Q: What is an Operating System (OS)?
A: The comprehensive suite of system programs managing memory, CPU time, input/output, and storage.Q: What are Programming Paradigms?
A: Different approaches to programming, such as procedural and object-oriented programming.Q: What does the Arithmetic and Logic Unit (ALU) do?
A: It performs arithmetic calculations and logical comparisons.Q: What is the purpose of the Input/Output (I/O) Unit?
A: To manage hardware interfaces to external peripheral equipment.Q: What is Secondary Storage?
A: Nonvolatile storage that provides permanent data storage, such as hard drives.Q: What is a Bit?
A: The primary atomic unit of data holding a value of 0 or 1.Q: What is a Byte?
A: A grouping of 8 bits representing a single distinct character.Q: What are Character Codes?
A: Binary pattern mappings used to encode textual characters.