Sequential Coupling
Encyclopedia
In object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, sequential coupling refers to a class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 that requires its method
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...

s to be called in a particular sequence. This may be an anti-pattern
Anti-pattern
In software engineering, an anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.The term was coined in 1995 by Andrew Koenig,...

, depending on context.

Methods whose name starts with Init, Begin, Start, etc. may indicate the existence of sequential coupling.

Using a car as an analogy
Car analogy
The car analogy is a common resort exploited by engineering textbooks to ease the understanding of some abstract concepts found within it.-Uses of car analogies:...

, if the user steps on the gas without first starting the engine, the car does not crash, fail, or throw an exception - it simply fails to accelerate.

Side Note: Exceptions are acceptable some of the time because programs (especially large ones) need the feedback to determine why an object is not performing the expected behavior when one of its methods is called. Object initialization is not always possible at construction and may need to be delayed to a later time. The programmer using a class may not be the same programmer who wrote it.

Sequential coupling can be refactored with the Template method pattern
Template method pattern
In software engineering, the template method pattern is a design pattern.It is a behavioral pattern, and is unrelated to C++ templates.-Introduction:A template method defines the program skeleton of an algorithm...

 to overcome the problems posed by the usage of this anti-pattern
Anti-pattern
In software engineering, an anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.The term was coined in 1995 by Andrew Koenig,...

.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK