Patterns for Injection of Mock Objects in a Modeling Environment

University essay from Linköpings universitet/Programvara och system

Abstract: Capsules are modeling language elements which are sometimes used to develop real-time software. One way to test such capsule elements without relying on dependencies to other units is to use mock objects. The aim of the study was to look at existing object-oriented design patterns and investigate how they could be used for capsules, in order to perform mock testing. The focus was to find solutions that were usable from the programmers’ point of view, meaning that they should promote high user effectiveness, efficiency and satisfaction when implementing them. It was also important that program efficiency wasn’t affected negatively. 5 design- or refactoring patterns were adapted for capsules: Constructor Injection, Setter Injection, Parameterize Method, Factory Method and Abstract Factory. Those patterns were evaluated by 5 programmers in a usability test, where Incarnate Injection (an adaptation of Constructor Injection) and Abstract Factory were considered most usable. Incarnate Injection seemed to be easier to implement and promoted high user efficiency, while Abstract Factory was considered more flexible. The performance tests indicated that Abstract Factory compromises program efficiency when the factory product is resource-heavy and is required frequently by dependent capsules. The study showed that it is possible to adapt design patterns to capsules by looking at conceptual similarities between capsules and classes. However, there are cases when this adaptation is impossible. Furthermore, even when adaptation is possible, it was apparent that different patterns adapt differently well to capsules.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)