2018 CodeWordChecker - Teacher Notes
2018 CodeWordChecker - Teacher Notes
In the original FRQ, StringChecker was an interface with just one method:
boolean isValid(String str). The 2020 changes to the AP CS A course removed abstract classes and
interfaces from the curriculum.
Changes:
Solution:
public class CodeWordChecker extends StringChecker
{
private String exclude; // only one instance variable needed
// if students create a min and max
// they will be shadowing
// the StringChecker's instance variables
Students should not shadow the parent class's instance variables. They need to reuse code instead of rewrite or copy existing code. This version of
the FRQ is testing code reuse. Shadowing the parent class's instance variables, in general, is a dangerous thing to do. The child's copy of the
instance variables may get out of sync with the parent's instance variables, because changes to either set will not be reflected in the other set. The
logic of isValid depends on the min and max values that were sent to the parent. Any changes to those variables should happen in the parent
class. The child class should only access and/or change those variables by way of parent methods.