Title
Common Mistakes When Using the Command Pattern and How to Avoid Them
Abstract
ABSTRACTCommand, is a behavioral pattern from the Gang of Four catalog that allows us to structure an application with respect to primitive actions that can be easily managed and executed. The main idea is to decouple the objects that invoke actions from the objects that know how to perform them, by encapsulating everything that is needed for executing the actions in corresponding command objects. The application can comprise different classes of command objects that realize different actions. The different classes of command objects implement the same interface. Therefore, command objects can be passed as parameters to other objects that use them to execute the respective actions, without knowing how this is actually done. This paper revisits the Command pattern, focusing on the configuration of command objects, when the data that are needed for the execution of the actions become available as soon as the actions should be executed. In this case, it is not clear which class is responsible for configuring the command objects and how this should be done. The paper reports common mistakes when dealing with this problem, as anti-patterns, observed during the project of a software engineering course. The observed mistakes invalidate the benefits of the Command pattern because the invoking objects are explicitly or implicitly coupled with the concrete classes of command objects that realize the different actions. The paper further introduces a pattern that deals with the problem.
Year
DOI
Venue
2020
10.1145/3424771.3424773
Pattern Languages of Programs
DocType
Citations 
PageRank 
Conference
0
0.34
References 
Authors
0
1
Name
Order
Citations
PageRank
Apostolos Zarras129330.20