Temporal Coupling

Learn about temporal coupling with a simple coding example.

What’s temporal coupling?

Temporal coupling deters code-readability. It occurs whenever a class’s design is such that two or more of its methods follow an invocation order that closely binds the result of a method call to that of the one that directly follows it. Class setters are enforcers of this anti-pattern.

Problem scenario

Take a close look at the snippet below.

Get hands-on with 1200+ tech skills courses.