Hyperon concepts


Parameters and functions answer the question of how you would like to parameterize. Context answers the question of what parametrization can depend on. And least but not last -- domain answers the question of what you would like to parameterize.

Indeed, domain model is what we want to be configurable.

  • Using Menu-Model-Domain definition we can design domain types, their relationships and attributes.
  • Using Menu-Model-Domain configuration we can create instances of domain types and configure their attributes with use of parameters or functions.

Imagine, we want to configure life insurance products:

  • Each life insurance product consists of covers and funds.
  • Each cover has different maximum insurance sum, availability logic, premium logic, etc.
  • Each fund has different transfer fee, etc.

We can use Domain definition to define types for our domain, for instance:

type:       Product
attributes: none
  - covers: Cover[]     // each Product has collection of Cover elements
  - funds:  Fund[]      // each Product has collection of Fund elements

type:       Cover
  - max_insurance_sum   // value we want to configure
  - is_available        // boolean - we want to make cover unavailable for some contexts
  - base_premium        // decimal value that we want to calculate with our tariff algorithm

type:       Fund
  - transfer_fee
  - ...       

Next, we can use Domain configuration to configure domain elements and their attributes:

Product [code = PR1]
    * Cover[CA]
       - max_insurance_sum   =  10000
       - is_available        =  yes
       - base_premium        =  50.0
    * Cover[CB]
       - max_insurance_sum   =  from parameter : 'pr1.covers.maxInsuranceSum'
       - is_available        =  yes
       - base_premium        =  from function  : 'pr1.premium.calculate'

Product [PT3]
    * Cover[DB]
       - max_insurance_sum   =  from function  : 'default.maxInsuranceSum'
       - is_available        =  from parameter : 'pt3.cover.isAvailable'
       - base_premium        =  from parameter : 'pt3.tariff.basePremium'

and so on...      

Now, application connected to Hyperon can use any defined logic solely through domain layer. These are sample scenarios:

  • getting all products from domain,
  • getting all covers from product "PT3",
  • getting all covers (from given product) with attribute is_available equal to true,
  • calculate premium for given cover - just by getting value from base_premium attribute.

We recommend not to use parameters and functions directly in application's code. Instead we advise to use parameterization only through domain layer. Such approach, which we call polymorphic configurations, makes application even better separated from business logic. Read Using domain to see more details.

Following image shows an example of domain configuration.