AP CSA

Methods To facts …

Topic Basic Intermediate Advanced
Procedural abstraction
Understand the concept of procedural abstraction
Recognize how methods hide implementation details
Use methods to break down complex problems into smaller sub-problems
Explain how procedural abstraction enhances code reusability
Design efficient and modular systems using procedural abstraction
Analyze trade-offs between abstraction and performance
Method signatures
Identify the three parts of a method signature (return type, name, parameter list)
Identify whether a given call to a method matches a given signature for that method.
Identify whether a call to a method can be used in a given context, based on the return type of the method.
Explain the purpose of void methods.
Given an English language description that gives the name of the method and explicitly describes the return type and argument types , write a correct method signature. E.g. “write a method named foo that takes two ints and returns a String consisting of …”
Given an English language description of what a method should do, write a correct method signature with correct return type and parameter types and clear names for the method and any parameters.
Explain the difference between public and private methods.
Explain the advantages of making methods private.
Calling methods
Call no-arg methods.
Call existing methods with the correct number and type of arguments using literals values.
Call existing methods with the correct number and type of arguments using existing variables for the values.
Call non-void methods to get values used to initialize variables.
Call void methods for effect, e.g. yertle.forward(), System.out.println("hello")
Call existing methods with the correct number and type of arguments using compound expressions for the values.
Call non-void methods as part of larger expressions.
From a set of methods, identify which method can be used to compute a desired value.
Understand how arguments are matched to parameters
Use correct syntax for calling methods within the same class.
Call static methods using the class name.
Explain the shorthand for calling methods of a class within that class.
Call methods in expressions that provide the arguments to another method call.
Call a method as the expression in a return statement to compute the value returned by one method by calling another method.
From a set of methods, identify how to combine calls to two or more methods to compute a desired value.
Explain what “pass by value” means for reference types.
Understand the implications of modifying mutable objects passed as arguments.
Explain the difference between mutating an argument and assigning a new value to a parameter.
Writing methods
Write methods that take zero or one arguments.
Write non-void methods that return the value of a simple expression.
Write void methods consisting of one statement, such as a call to System.out.println
Write methods that take zero, one, or two arguments.
Write non-void methods that return the value of a complex expression, possibly involving calls to other methods.
Write methods that declare local variables to simplify or clarify a computation.
Write void methods consisting of multiple statements.
Write methods that call other methods.
Write methods that take arbitrary numbers of arguments.
Write methods in terms of other methods to remove duplication.
Write overloaded methods.
Given a short sequence of code, create a procedural abstraction by writing a method that takes arguments whose body is the original code with appropriate parts replaced with the arguments.
Decompose complex methods into simpler code by writing helper methods.
Implement and use method chaining.
Write methods that call themselves (a.k.a. recursive methods).
Math methods
Use Math.abs, Math.pow, and Math.sqrt in mathematical expressions.
Use Math.random to generate random numbers of a given type (int or double) in a given range.
Use Math.random to generate random numbers of a given type involving other mathematical functions, e.g. a random power of ten from 1 to 1,000,000.