CS Principles 2020-2021

Unit 7 - Parameters, Return, and Libraries

Lesson 1: Parameters and Return Explore

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.

CSP2021

AAP-3 - Programmers break down problems into smaller and more manageable pieces
AAP-3.A - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.`
• AAP-3.A.1 - A procedure is a named group of programming instructions that may have parameters and return values.
• AAP-3.A.3 - Parameters are input variables of a procedure. Arguments specify the values of the parameters when a procedure is called.
AAP-3.B - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.
• AAP-3.B.4 - A procedural abstraction may extract shared features to generalize functionality instead of duplicating code. This allows for program code reuse, which helps manage complexity.
• AAP-3.B.5 - Using parameters allows procedures to be generalized, enabling the procedures to be reused with a range of input values or arguments.
• AAP-3.B.6 - Using procedural abstraction helps improve code readability.

Lesson 2: Parameters and Return Investigate

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3B-AP-23 - Evaluate key qualities of a program through a process such as a code review.

CSP2021

AAP-2 - The way statements are sequenced and combined in a program determines the computed result
AAP-2.C - Evaluate expressions that use arithmetic operators.
• AAP-2.C.3 - The exam reference sheet provides the arithmetic operators +, -, *, /, and MOD. ●       a + b●       a – b●       a * b●       a / b●       a MOD bThese are used to perform arithmetic on a and b. For example, 17 / 5 evaluates to 3.4.
AAP-3 - Programmers break down problems into smaller and more manageable pieces
AAP-3.B - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.
• AAP-3.B.4 - A procedural abstraction may extract shared features to generalize functionality instead of duplicating code. This allows for program code reuse, which helps manage complexity.
• AAP-3.B.5 - Using parameters allows procedures to be generalized, enabling the procedures to be reused with a range of input values or arguments.
• AAP-3.B.6 - Using procedural abstraction helps improve code readability.

Lesson 3: Parameters and Return Practice

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.

CSP2021

AAP-2 - The way statements are sequenced and combined in a program determines the computed result
AAP-2.C - Evaluate expressions that use arithmetic operators.
• AAP-2.C.2 - The exam reference sheet provides a MOD b, which evaluates to the remainder when a is divided by b. Assume that a is an integer greater than or equal to 0 and b is an integer greater than 0. For example, 17 MOD 5 evaluates to 2.
AAP-2.O - For algorithms involving elements of a list: a. Represent using iterative statements to traverse a list. b. Determine the result of an algorithm with list traversals.
• AAP-2.O.1 - Traversing a list can be a complete traversal, where all elements in the list are accessed, or a partial traversal, where only a portion of elements are accessed. EXCLUSION STATEMENT (EK AAP-2.O.1): Traversing multiple lists at the same time using the sam
AAP-3 - Programmers break down problems into smaller and more manageable pieces
AAP-3.A - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.`
• AAP-3.A.5 - The exam reference sheet provides procName (arg1, arg2, …) as a way to call PROCEDURE procName(parameter1, parameter 2, …) which takes zero or more arguments; arg1 is assigned to parameter1, arg2 is assigned to parameter2, and so on.
• AAP-3.A.7 - The exam reference sheet provides the RETURN(expression) statement, which is used to return the flow of control to the point where the procedure was called and to return the value of expression.
• AAP-3.A.8 - The exam reference sheet provides result ß procName(arg1, arg2, …) to assign to result the “value of the procedure” being returned by calling PROCEDURE procName(parameter1, parameter2, …)
AAP-3.C - Develop procedural abstractions to manage complexity in a program by writing procedures.
• AAP-3.C.1 - The exam reference sheet provides PROCEDURE procName(parameter1, parameter2, …){<block of statements>}which is used to define a procedure that takes zero or more arguments. The procedure contains block of statements.
• AAP-3.C.2 - The exam reference sheet providesPROCEDURE procName(parameter1, parameter2, …){ <block of statements> RETURN(expression)}which is used to define a procedure that takes zero or more arguments. The procedure contains block of statements and returns th

Lesson 4: Parameters and Return Make

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.

CSP2021

CRD-2 - Developers create and innovate using an iterative design process
CRD-2.F - Design a program and its user interface.
• CRD-2.F.7 - The design phase of a program may include: ●        brainstorming ●        planning and storyboarding ●        organizing the program into modules and functional components ●        creation of diagrams that represent the layouts of the user interface ●

Lesson 5: Libraries Explore

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.

CSP2021

AAP-3 - Programmers break down problems into smaller and more manageable pieces
AAP-3.D - Select appropriate libraries or existing code segments to use in creating new programs.
• AAP-3.D.1 - A software library contains procedures that may be used in creating new programs.
• AAP-3.D.2 - Existing code segments can come from internal or external sources, such as libraries or previously written code.
• AAP-3.D.3 - The use of libraries simplifies the task of creating complex programs.
• AAP-3.D.4 - Application program interfaces (APIs) are specifications for how the procedures in a library behave and can be used.
• AAP-3.D.5 - Documentation for an API/library is necessary in understanding the behavior(s) provided by the API/library and how to use them.

Lesson 6: Libraries Investigate

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 2-AP-17 - Systematically test and refine programs using a range of test cases.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.
• 3B-AP-23 - Evaluate key qualities of a program through a process such as a code review.

CSP2021

AAP-2 - The way statements are sequenced and combined in a program determines the computed result
AAP-2.M - For algorithms: a. Create algorithms. b. Combine and modify existing algorithms.
• AAP-2.M.1 - Algorithms can be created from an idea, by combining existing algorithms, or by modifying existing algorithms.
• AAP-2.M.2 - Knowledge of existing algorithms can help in constructing new ones. Some existing algorithms include:●       determining the maximum or minimum value of 2 or more numbers ●       computing the sum or average of 2 or more numbers●       identifying if a
• AAP-2.M.3 - Using existing correct algorithms as building blocks for constructing another algorithm has benefits such as reducing development time, reducing testing, and simplifying the identification of errors.
AAP-3 - Programmers break down problems into smaller and more manageable pieces
AAP-3.B - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.
• AAP-3.B.1 - One common type of abstraction is procedural abstraction, which provides a name for a process and allows a procedure to be used only knowing what it does, not how it does it.
• AAP-3.B.2 - Procedural abstraction allows a solution to a large problem to be based on the solution of smaller subproblems. This is accomplished by creating procedures to solve each of the subproblems.
• AAP-3.B.3 - The subdivision of a computer program into separate subprograms is called modularity.
• AAP-3.B.4 - A procedural abstraction may extract shared features to generalize functionality instead of duplicating code. This allows for program code reuse, which helps manage complexity.
• AAP-3.B.5 - Using parameters allows procedures to be generalized, enabling the procedures to be reused with a range of input values or arguments.
• AAP-3.B.6 - Using procedural abstraction helps improve code readability.
• AAP-3.B.7 - Using procedural abstraction in a program allows programmers to change the internals of the procedure (to make it faster, more efficient, use less storage, etc.) without needing to notify users of the change as long as what the procedure does is preserved
AAP-3.D - Select appropriate libraries or existing code segments to use in creating new programs.
• AAP-3.D.2 - Existing code segments can come from internal or external sources, such as libraries or previously written code.
• AAP-3.D.3 - The use of libraries simplifies the task of creating complex programs.

Lesson 7: Libraries Practice

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 2-AP-17 - Systematically test and refine programs using a range of test cases.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.

Lesson 8: Project - Make a Library Part 1

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-14 - Construct solutions to problems using student-created components, such as procedures, modules and/or objects.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.

CSP2021

CRD-2 - Developers create and innovate using an iterative design process
CRD-2.H - Acknowledge code segments used from other sources.
• CRD-2.H.1 - It is important to acknowledge any code segments that were developed collaboratively or by another source.
• CRD-2.H.2 - Acknowledgement of code segment(s) written by someone else and used in a program can be in the program documentation. The acknowledgement should include the origin or original author’s name.

Lesson 9: Project - Make a Library Part 2

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-14 - Construct solutions to problems using student-created components, such as procedures, modules and/or objects.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.

Lesson 10: Project - Make a Library Part 3

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-14 - Construct solutions to problems using student-created components, such as procedures, modules and/or objects.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.

CSP2021

CRD-2 - Developers create and innovate using an iterative design process
CRD-2.H - Acknowledge code segments used from other sources.
• CRD-2.H.1 - It is important to acknowledge any code segments that were developed collaboratively or by another source.
• CRD-2.H.2 - Acknowledgement of code segment(s) written by someone else and used in a program can be in the program documentation. The acknowledgement should include the origin or original author’s name.