Implementing the State-Space Representation by the Super Operator Design Pattern

Authors

  • Gábor Kusper
  • Csaba Sass
  • Szabolcs Márien

Keywords:

design patterns, state-space representation, super operator design pattern

Abstract

While implementing state-space representation technique of artificial intelligence we found that the mathematical design suggests having a separate state and operator classes. But this breaks the encapsulation principle of OOP. To solve this we introduce a new structural design pattern, the super operator design pattern. A super operator is a proxy to operators, it has a parameter which decides which operator to call, it returns what the operator returns. In this way one class can represent the state-space representation which contains the operators and the states, so we can preserve encapsulation. On the other hand we break separation of concerns and single responsibility principles, since we do not separate states and operators. The set of methods behind the super operator should have a similar contract, because the super operator can ensure only the common part of the contracts of the methods. If this common part is empty, then this design pattern cannot be used. The new design pattern is applicable if iteration over a set of methods is important; a set of methods have similar contract, for the client is all them same which one is called; the understandability is more important than reusability, e.g., educational purposes; forcing encapsulation over separation of concerns is essential.

Downloads

Published

2019-12-30