APCSP Topic 1.3: Program Design and Development Study Notes
Development Process: Incremental and Iterative Methods
Incremental Development Process:
Definition: A step-by-step approach to program development where code is constructed in small, manageable pieces.
Implementation: Involves writing one procedure or function at a time, testing it, and then moving on to the next section of code.
Complexity Management: Breaking down a large program into short, modular, testable procedures reduces overall coding complexity. Writing and testing multiple short programs or functions is far easier than writing a single monolithic program all at once.
Standard AP Exam Answer: When asked how to manage program complexity using procedures or functions, the standard answer is to divide the program into multiple short, testable procedures.
Iterative Development Process:
Definition: A cyclic process centered around repetition, continuous testing, and refining based on test outcomes.
Code-Level Iteration: Implemented using repetition control structures such as
repeatloops orforloops.Process-Level Iteration: Involves repeatedly running tests on the program and fixing or refining the code based on those test results.
Historical Context: Highlighted in AP Create Task specifications (such as the 2018 Create Task rubric) as the cycle of continuous testing and bug-fixing.
Combining Incremental and Iterative Development:
Practical Workflow: Software development in practice combines both methods into a continuous loop:
Split the overall program logic into multiple functions and write them one at a time (Incremental).
Test each function or procedure after writing it and make necessary improvements or bug fixes (Iterative).
Repeat this process continuously throughout development.
Key Benefits:
Early Error Identification: Allows developers to catch logic and runtime errors early in the process rather than at the end.
User Feedback Integration: Facilitates incorporating feedback throughout the development cycle.
Program Requirements and the Investigation Phase
Investigation Phase:
Phase Characteristics: Represents the early preliminary stage of the software development lifecycle.
Key Activities:
Brainstorming project ideas and user requirements.
Defining user needs, project constraints, and core program goals.
Researching problem domains prior to writing code.
Non-Investigation Activities:
Finalizing program code or completing final deliverables (these occur during the late stages of development, not the investigation phase).
Code Documentation Practices and Formulas
Purpose and Scope of Documentation:
Definition: Written descriptions or instructions explaining how a program or specific code segment operates.
Target Audience: Written to help team members, outside programmers, and the original author understand the code logic (especially when revisiting code weeks or months later).
Timing: Documentation should be initiated at the start of project development and updated continuously whenever code is altered or added.s
System Impact: Documentation and comments are completely ignored by computer execution engines; they do not improve execution speed nor do they instruct the computer on code optimization.
Formula for Documenting Procedures:
When asked to document a procedure or function, follow a four-part standardized formula:
Name: The exact name of the procedure.
Description / Functionality: A clear summary of what the procedure does.
Parameters (Inputs): The data values or arguments passed into the procedure.
Returns (Outputs): The data or result returned by the procedure.
Practical Example (Maximum Value Finder):
Procedure Name:
findMaxDescription: Evaluates a list of numerical values to identify and extract the largest number.
Inputs / Parameters:
numbersList(a list containing numerical elements).Outputs / Return Value:
maxValue(the highest number found within the list).
Analyzing Code Functionality and Boundary Conditions:
Documentation questions often require identifying what a code segment does along with its potential edge cases.
APCSP Pseudo-Code Syntax Rule:
The arrow symbol (
←) denotes assignment or equality (=). Whenever←appears, mentally substitute the equals sign.Boundary Conditions and Edge Cases Example (Averaging Code):
Code that calculates an average sums items in a list and divides by the total list length.
Boundary Case: An empty list containing items.
Runtime Error: Dividing by a list length of triggers a division-by-zero runtime error.
Best Documentation Practice: Explicitly document prerequisites, such as requiring the input list to contain at least one element to prevent runtime errors.
Acknowledgements and Code Attribution
Citing External Code:
Any program code incorporated into a project that was authored by an external source must be explicitly acknowledged and cited.
Serves to maintain academic integrity and prevent plagiarism.
Create Task and Personalized Project Reference (PPR) Rules:
External code used in a project must be cited within program comments.
PPR Code Requirement: Code selected for inclusion in the Personalized Project Reference (PPR) for the AP Create Task must be written entirely by the student.
Code cited from external sources is strictly prohibited from being submitted in the student's PPR response.
Ideal PPR Student Code: Must be student-written and should ideally include parameters and selection control structures (
if-elsestatements) to satisfy all scoring rubrics.
Questions & Discussion
Question 1: Benefits of Documentation
Question: Documentation helps with which of the following? (1: Remembering what code does; 2: Solving all coding error problems; 3: Helping people understand the code)
Analysis: Statement 1 is correct because documentation provides a reference for developers. Statement 2 is incorrect because documentation does not automatically resolve coding bugs. Statement 3 is correct because documentation aids external readers in understanding code structure.
Answer: Option C (Statements 1 and 3 are true).
Question 2: Benefits of Combining Iterative and Incremental Development
Question: Which are benefits of combining iterative and incremental development processes?
Analysis: Combining iterative (testing/refining) and incremental (modular building) workflows allows developers to identify errors earlier in development and incorporate feedback continuously. Unrelated distractor technical jargon should be excluded.
Answer: Statements 1 and 2 are true benefits.
Question 3: Activities in the Investigation Phase
Question: Which of the following activities might occur during the investigation phase? (1: Brainstorming user needs; 2: Defining requirements; 3: Finalizing program code)
Analysis: The investigation phase is dedicated to preliminary research, user feedback gathering, and requirement definitions. Finalizing program code occurs at the end of development.
Answer: Option B (Activities 1 and 2).
Question 4: Documentation and Pseudo-Code Analysis
Question: What is the most appropriate documentation for a code segment that sums and divides elements in a list?
Analysis: While basic documentation stating that the program computes an average is partially true, the most complete documentation accounts for potential edge-case errors, explicitly noting that an empty list produces a division-by-zero runtime error.
Answer: Option D (Documentation explicitly identifying the empty list division-by-zero error scenario).
Question 5: Functions of Program Comments
Question: What can comments be used for? (A: Tell computer what to optimize; B: Document code; C: Acknowledge external code; D: Increase execution speed)
Analysis: Compilers and execution engines completely ignore program comments. Therefore, comments cannot instruct computer optimizations (Option A) nor increase execution speed (Option D). They are used strictly to document code (Option B) and acknowledge cited sources (Option C).
Answer: Options B and C.