Design and Architecture of Complex Software Systems (DACSS)

Assignment 2: The Reflection Pattern - Track B: Building a meta layer architecture

Adaptive Object Model

This is one of the choices for Assignment 2.

Goal: Design and implement a reflective architecture ("homemade" meta-layer)

Assignment description

Using the Dynamic Object Model presented in Lecture dacss5-2023.ppt, implement a dynamic model for managing merchandises in a store.

For each type of product one must be able to define the relevant types of attributes and how the price of the produxt is computed as a function of their values.

The model must offer support to describe any types of products (cars, insurance policies, toys, etc). The types of products are not known in advance. Every product type can have different types of attributes.

For example, in the case of products of the type insurance policies, each kind of policy (home, life, accidents, travel, etc) has a different set of attributes. A home insurance has for example following attributes: initial value at building time, age, location. A car insurance has as relevant attributes the brand, the age and engine power.

For each product type (home insurance, life insurance, car insurance, etc) we can define business rules that describe their algorithm of price computation. For example, for a car insurance the price is computed according to the following rule: price=1000*coef_lookup(brand)-10*age+5*engine_power

Standard requirements: The standard requirements for this assignment variant already include 1 Bonus point.

Following features must be supported:

  • create at runtime new product types
  • create at runtime business-rules for computing the price of the products of a certain priduct type
  • create at runtime products (instances) of the already defined types, set values for their properties (the system must verify that the property is valid for the given product type and that the values is valid for the property type )
  • calculate the price of a product instance
  • modifying at runtime a product type (by adding or removing allowed property types, keeping existing instances consistent/notified by the change)
  • list all existing products with the values of their properties

    For the standard requirement, the program does not need to be interactive, just demonstrate the concepts and patterns. It can be something similar with code on Slide 38 of lecture dacss5-2023.ppt, but include also a demo for the creation of price business rules and their application.

    Additional bonus points: a second award point for implementing the following extension according to the Adaptive Object Model pattern:

  • Generalize the Dynamic Object Model for any kind of Entity Types.
  • Define a Domain Specific Language that can be used to manipulate entities and entity types.

  • Implement a interpreter for DSL commands

  • Construct at least 2 different usage scenarios in different application domains.

    Example1: Creating and using bank account application

    Example2: Creating and using shop inventory application

    Bibliography