Review the design choices, not just the syntax

Object-oriented programming is more than adding CLASS statements. The useful question is how to divide responsibility so that each caller has a clear contract and each object protects its own rules.

A few principles to carry forward

  • Use a local class for a helper that belongs to one program; use a global class when repository-wide reuse is intentional.
  • Keep object-specific state on instances and protect invariants through methods.
  • Use interfaces for capabilities, composition for collaborators, and inheritance for substitutable specializations.
  • Reach for exceptions to make failure explicit; catch only where meaningful recovery or reporting is possible.
  • Add ABAP Unit tests for observable behavior, with fakes or test doubles around replaceable collaborators.

Patterns such as Factory and Singleton are tools, not checkboxes. A Factory can hide a nontrivial construction choice. A Singleton can centralize a shared instance but risks hidden global state and poor test isolation. Prefer a simple injected instance unless shared identity is truly required.

Try the quiz

The questions below are original. They review independently authored examples and design tradeoffs; they are not copied from a course assessment. The browser quiz does not run ABAP.

Sources and scope

This learning path is an original, bounded introduction to commonly used ABAP Objects concepts, not an exhaustive reference to every ABAP OO feature. Check your system’s release and language version before applying syntax or APIs.

Developer practice · ABAP

Practice: ABAP Objects knowledge check

Choose one answer per question. These independent review questions reinforce the OO techniques and tradeoffs in this path.

1. A helper used only by one program is a candidate for which class scope?

2. What does assigning one object reference to another normally do?

3. Where should a rule-protected mutable status usually live?

4. What does an interface primarily describe?

5. When is composition commonly preferable to inheritance?

6. What problem does a Singleton pattern attempt to address?

7. What is a factory's main job in the lesson example?

8. What does the ABAP Unit assertion compare?

9. Does the website's coding checker execute ABAP or ABAP Unit?