Appearance
Lesson 9 Companion — Static Members, Constants & Utility Classes
1. SAP static method semantics
CLASS-METHODS declares static behavior and can be called with => independently of object instances.
2. Constants are static attributes
Constants declared in a class belong to its static components and require a VALUE at declaration time.
3. Why caution around CLASS-DATA
Shared mutable state is sometimes valid, but it adds implicit coupling. A counter is useful pedagogically because it proves the value is class-wide, not object-specific. It should not teach “put shared application state in static variables.”
4. READ-ONLY
A public attribute declared READ-ONLY can be read externally but is only writable in allowed internal class contexts. It can be useful for observability without public mutation.
5. Utility class design
A utility class is strongest when methods are deterministic and stateless. If dependencies or configuration grow, refactor to instance objects/interfaces instead of accumulating global class state.