Code Monkey home page Code Monkey logo

abstract-pricing's Introduction

Abstract Pricing Model for .NET

High-level abstract model for calculating price of subscriptions and/or other products and services

Console output Class Diagram

Each Tariff is composed by a list of Fees. Tariff contains minimal logic and provides unified interface for calculating Fees. Tariff implements Fascade pattern to operate list of Fee objects.

Terminology and main classes

  • Tariff is a class representing the main entity the model is going to compare. Tariff, product, service and subscription are hereby considered the same thing. Tariff aggregates a set of fees. Tariff classes are designed to be reused when same pricing model is required, only with different values.
  • Fee is is a class that comprises a Tariff - a Tariff has many Fees. Each Fee implement it's own 'Calculate(...). E.g. some fees are based on consumption, while others on fixed periods of time.
  • Applying a fee is the process of calculation of cost - really done in IFee.Calculate(...). When Calculate(...) is called on Tariff object it calls Calculate(...) on each Fee and aggregates the result

Common actions

Add a Tariff

To add a new Tariff extend the abstract Tariff class.

Add a Fee

Extend and implement from IFee interface. Use the Fee within a Tariff class.

Change calculation algorithm

Override Calculate(...) from the base abstract Tariff class.

Add features to the model

To add features to the model, like add more unit types or change calculation algorithm, re-implement the ITariff and IFee interfaces. Consumption class is also meant to be extended as needed

abstract-pricing's People

Contributors

shturm avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.