AP CSA

Object oriented design To facts …

Topic Basic Intermediate Advanced
Built in classes
Understand that Java classes are grouped into packages
Know that java.lang package is always available in Java programs
Identify common classes from java.lang: String, Math, System, Integer, Double, Boolean, Object
Understand the need to import classes from other packages (e.g., ArrayList from java.util)
Use Java documentation to find information about built-in classes
Explain the concept of Application Program Interfaces (APIs) and libraries
Analyze class documentation to understand attributes, constructors, and methods
The System class
Use System.out.print and System.out.println for console output
Understand the difference between print and println
Use System.err for error output
Understand the concept of standard input, output, and error streams
Use other methods of the System class (e.g., System.currentTimeMillis())
Understand the role of the System class in providing system-related utilities
The Math class
Understand that Math class contains only static methods
Use basic Math methods: abs(), pow(), sqrt(), random()
Use Math.PI for calculations involving π
Understand the return types of various Math methods
Implement algorithms using combinations of Math methods
Understand the limitations of floating-point arithmetic in Java
Access modifiers
Understand the purpose of public and private access modifiers
Apply public and private modifiers to class members appropriately
Explain why instance variables are usually made private
Understand the implications of making methods public or private
Discuss the use of package-private (default) access
Understand the protected modifier in the context of inheritance
Encapsulation
Understand the concept of encapsulation as hiding implementation details
Implement basic getter and setter methods
Design classes to control access and modification of their state
Implement encapsulation to create more robust and maintainable code
Discuss trade-offs between accessibility and encapsulation
Implement advanced encapsulation techniques (e.g., immutable classes)
this
Use 'this' to refer to the current object in instance methods and constructors
Use 'this' to disambiguate between instance variables and parameters
Use 'this' to call other constructors within a constructor
Pass 'this' as an argument to other methods
Understand the implications of returning 'this' from methods
Discuss potential issues with exposing 'this' in constructors
Comments
Use // for single-line comments
Use /* */ for multi-line comments
Use /** */ for Javadoc comments
Write meaningful comments that explain 'why' rather than 'what'
Generate and understand Javadoc documentation
Follow best practices for commenting code in large projects
Invariants
Understand the concept of invariants in programming
Identify simple preconditions and postconditions for methods
Write code that maintains class invariants
Use assertions to check invariants during development
Design complex systems using invariants to ensure correctness
Discuss the role of invariants in formal program verification
Overloading
Understand method overloading (multiple methods with the same name but different parameters)
Implement overloaded constructors
Understand how Java resolves calls to overloaded methods
Implement overloaded methods with covariant return types
Discuss best practices and potential pitfalls of method overloading
Understand the interaction between overloading and variable argument methods