Please enable JavaScript to use CodeHS

Teaching AP® Computer Science A

Description

In this lesson, students will explore and learn the anatomy of classes. They will take a deeper dive into what the access specifier does, and how it can be used within programs to make data public or private. Students will learn about encapsulation and the responsibility programmers have to choose whether data should be accessible, modifiable, both or neither. This lesson corresponds with AP Computer Science A topic 5.1.

Objective

Students will be able to:

  • Designate access and visibility constraints to classes, data, constructors, and methods
  • Designate private visibility of instance variables to encapsulate the attributes of an object
Description

In this lesson, students will expand their knowledge of constructors. They will create constructors that take objects as a formal parameter. This lesson corresponds with AP Computer Science A topic 5.2.

Objective

Students will be able to:

  • Define instance variables for the attributes to be initialized through the constructors of a class
Description

In this lesson, students will examine writing classes in more detail. It is a good programming practice to avoid altering objects within methods unless the method specifically calls for alterations to the object. Accessor and getter methods make obvious changes to objects, but most methods should not attempt to make changes unless it?s explicitly necessary. This lesson corresponds with AP Computer Science A topic 5.6.

Objective

Students will be able to:

  • Discuss changes to both primitive and reference formal parameters in methods
Description

In this lesson, students will learn about scope and access. The placement of a variable within a program affects the scope of the variable, meaning where it can be used and accessed in a program. Students will learn how to avoid scope and access errors by using method decomposition. This lesson corresponds with AP Computer Science A topic 5.8.

Objective

Students will be able to:

  • Explain where variables can be used in the program code
Description

In this lesson, students will learn about and create arrays. The use of array objects allows multiple related items to be represented using a single variable. This lesson corresponds with AP Computer Science A topic 6.1.

Objective

Students will be able to:

  • Represent collections of related primitive or object reference data using one-dimensional (1D) array objects
Description

In this lesson, students will learn how to traverse arrays. Iteration statements can be used to access all the elements in an array. This is called traversing the array. This lesson corresponds with AP Computer Science A topic 6.2.

Objective

Students will be able to:

  • Traverse the elements in a 1D array