Paradigms in practice
Is object-oriented programming obsolete?
On this page
The answer depends on which feature earns its keep. An object that owns a file and its cleanup has a precise responsibility. A hierarchy with a subtype for every enum value might make a finite set of cases harder to inspect. Evaluate a real change request against the design.
Worked example
Pythonfrom io import StringIO
handle = StringIO("release log")
with handle as stream:
assert stream.read() == "release log"
assert handle.closedExplore class relationships in the OOP Playground