| preferred AP College board partner for AP classes
Login
 
Register
Class Design and Abstraction Principles
< Prev
Next >

Represent the design of a program by using natural language or creating diagrams that indicate the classes in the program and the data and procedural abstractions found in each class by including all attributes and behaviors.
A programmer needs to refactor a complex inventory management system where multiple classes directly access and modify each other’s data fields. Which refactoring approach best applies abstraction principles to improve the design?

A

Combine all classes into a single large class to eliminate inter-class dependencies and simplify data access

B

Convert all instance variables to static variables and make all methods static to eliminate object creation overhead

C

Make all methods private and create a single public method in each class that handles all possible operations

D

Make all data fields private and create public accessor and mutator methods that encapsulate business rules and validation logic, then decompose complex operations into smaller, focused methods within each class

Check Answer
APFIVE © 2020.
Email: [email protected]|Privacy Policy