Choosing your Classes in OOD - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. In object-oriented program design, what are the highest-level elements?
Please select the best answer.
  A. Procedures
  B. Methods
  C. Classes
  D. Global variables
  The correct answer is C.
Classes are the highest-level element in object-oriented design. A is incorrect because procedures are the highest-level elements in structured (or procedural) programming. B is incorrect because methods are a part of classes. D is incorrect because global variables contain data in procedural programs.

2. Why might CustomerArray be a poor choice for a class name?
Please select the best answer.
  A. The name does not contain a verb.
  B. The name describes a computer concept.
  C. The name contains a second uppercase letter in the middle.
  D. The name is two words put together instead of a single word.
  The correct answer is B.
The idea is not to describe a computer process, but to describe a business situation. A is incorrect because verbs are typically used for methods or functions but not for class names. C is incorrect because the naming convention you choose does not affect what classes you create. Most developers start class names with capital letters, and customerarray or CustomerArray are both bad class names. D is incorrect because many good choices for class names have two-word or more names.

3. What is one defining characteristic of procedural, or structured, programming?
Please select the best answer.
  A. Top-down design
  B. Defining classes
  C. Identifying the problem domain
  D. Determining interaction of elements in the system
  The correct answer is A.
Top-down design is the basis of structured programming. B and D are incorrect because these are defining characteristics of OOP. C is incorrect because this is a characteristic of both procedural and object-oriented programming and can occur before the decision to use either procedural or OOP design .

4. What is one reason to eliminate a class from the problem domain?
Please select the best answer.
  A. The class pulls together a number of related pieces of information.
  B. The class is identical to another class.
  C. The class cannot be expressed with a short one-word name.
  D. The class represents an entity that is just a small part of the problem domain.
  The correct answer is B.
Class names that are synonymous with other class names or have identical responsibilities may be eliminated. A is incorrect because a class that pulls together a number of related pieces of information is a good class and should be kept. C is incorrect because a long or multiword class name does not in itself determine whether the class should be kept or eliminated. D is incorrect because as long as the entity that the class represents is a part of the problem scope, its relative size is not a reason in itself to eliminate it; however, the class in question may become part of a larger class if it is not sufficiently complex.