List Container

Introduction

Development of a reusable singly linked list. First we need to analyze the requirements different applications might have, such as type of elements, element traversal, storage layout, error detection etc. The different features are documented using feature diagrams. Finally, we should prioritize the features according to project goals.

Feature Diagram

  • List
    • [ElementType]
    • Ownership
      • External reference
      • Owned reference
      • copy
    • Morphology
      • Monomorphic
      • Polymorphic
    • LengthCounter
      • [LengthType]
        • int
        • short
        • long
    • Tracing

Implementation Components

Implementation using static parameterization. The implementation consists of the following components:

  • PtrList: Basic list functionality
  • LenList: Wrapper for adding a length counter to a list
  • TracedList: Wrapper for adding tracing to a list.

GenVoca Grammar

List: TracedList[OptCounterList] | OptCounterList
OptCounterList: LenList[BasicList] | BasicList
BasicList: PtrList[Config]
Config:
ElementType: [ElementType]
Destroyer: [EmptyDestroyer|ElementDestroyer]
TypeChecker: DynamicChecker | EmptyChecker

Target Architecture

Tracing Layer
TracedList

Counter Layer
LenList

BasicList
PtrList

Config
ElementType :[ElementType]
Destroyer :EmptyDestroyer|ElementDestroyer
Copier :PolymorphicCopier|MonomorphicCopier |EmptyCopier
LengthType : int | short | long | …
ReturnType

The implementation components constitute a layered architecture. Each rectangle represents a layer. A layer drawn on top of another layer refines the latter by adding new functionality. A component from one layer takes another component from the layer below as its parameter.
The bottom layer is referred to as the configuration repository. A configuration repository provides types needed by the other layers under standardized names. It works as a kind of registry, which components may use to retrieve configuration information from and also to exchange such information among each other. A configuration repository allows us to separate the configuration knowledge from the components.

Composing List Components

We have to define a configuration repository with the necessary configuration information.

Generating Lists from Abstract Specifications

Bibliography
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.