Skip to content

Requirements analysis

One of the key advantages of NPL is that translating requirements into code is often very straightforward.

Two important subjects to consider when analysing requirements are the states of the process and the interactions, and what follows are examples of what that requirement analysis might look like before proceeding to an implementation.

IOU example

Consider an IOU contract. An IOU is an agreement between two parties within which a lender loans a debtor an amount with terms for repayment to be completed by a specific date.

States

The following state diagram illustrates the states that an IOU can be in:

stateDiagram-v2
    [*] --> Unpaid
    Unpaid --> Forgiven
    Unpaid --> Paid
    state join_state <<join>>
    Paid --> join_state
    Forgiven --> join_state
    join_state --> [*]

Interactions

Consider the interactions between the parties and the means to pay and even potentially forgive the IOU:

sequenceDiagram
    IOU->>IOU: State: Unpaid
    Lender->>IOU: Provides liquidity
    activate IOU
    IOU->>Debtor: Receives liquidity
    opt Forgive at anytime
            Debtor-->>IOU: Forgives IOU
            IOU-->>IOU: State: Forgiven
    end
    Loop Partial Payment
        IOU->>IOU: Calculate Interest on amount due
        IOU->>Debtor: Collect partial payment + interest
        IOU->>Lender: Repay partial payment + interest
        IOU->>IOU: Update amount due
        opt Nothing due
            IOU-->>IOU: State: Paid
            deactivate IOU
        end
    end

Implementation

Refer to the IOU example in the language docs for a complete walkthrough of an NPL implementation of the IOU.

APIs

Furthermore, with the APIs also defined, we can correlate our NPL with the design and user journeys that, together with the back-end implementation, allows us to build and deploy a fully working system very easily using Noumena's tooling to provision, instantiate, run and manage a productive NPL cloud application.

Note

The requirement analysis described above only scratches the surface of what is necessary in order to build a production system. Other important considerations include:

  • Capacity - in terms of storage, for example
  • Compatibility
  • Reliability and availability
  • Maintainability and manageability
  • Scalability
  • Usability