Business Logic/Rules Examples

We often use the term business logic or business rules when we want to talk about what we should understand when we build a business IT system or just when we try to set the documentation level of an IT system. But most of the examples that I can find in the open space are so trivial that you can’t learn from them. Here are a few examples from ChatGPT:

User Registration

  • Business Rule: Users must register before making a purchase.
  • Logic: When a user registers, their information (name, email, password) is stored in the user database. Subsequent logins are authenticated against this database.

Product Catalog

  • Business Rule: Products are categorized, and users can browse the catalog.
  • Logic: Products are organized into categories (e.g., electronics, clothing). Users can view products within categories, search for specific items, and access detailed product information.

Shopping Cart

  • Business Rule: Users can add products to a shopping cart for later purchase.
  • Logic: A user can add products to their virtual shopping cart. The system keeps track of selected items, quantities, and prices. Users can review and modify their cart before checkout.

Above examples are valid use cases, and from the business side that is potentially not more to say even thought that from a technical perspective there might be substantial specification below. But they are no are not exemplary with respect to where it really matters – which is business logic/rules that goes beyond a one liner. Below you will find a more substantial business logic/rules example.

Business Rules for Salary Articulation

One important principle for expressing salary in a computable way is that we define a base salary and on top of that the increments to manage variations in compensation as a function of business rules. This is shown in the table below.

PeriodNameBase RateIncrement
06:00 – 08:00Early Supplement1.00+0.25
08:00 – 18:00Base Salary1.000.00
18:00 – 22:00Late Supplement1.00+0.25
Table of time of day tariffs.

There is also an increment in relation to overtime. Overtime is is defined as more than 8 hours on a day:

CriteriaNameBase RateIncrement
>8 HOvertime 11.00+0.25
Table of overtime tariffs.

One advantage of this model is that there is clear separation of contributions, making extra income (or from employer point of view costs) for working long or odd hours transparent. Additionally, the system typically uses a smaller number of rates, simplifying maintenance in relation to new tariffs, individual and yearly regulations.

If we now make the example that a worker works from 6 AM to 6 PM we will get the following contribution

  1. Base Salary (06:00 – 18:00):
    • Base Rate: 1.00
    • Hours: 12
  2. Early Contribution (06:00 – 08:00):
    • Increment: 0.25
    • Hours: 2
  3. Overtime (14:00 – 18:00):
    • Increment: 0.25
    • Hours: 4

This leads to a payment specification for the day

As said above, the supplements are with this business logic very transparent.

So what are the business rules here?

Before we get to the business rules we actually need to start with the definitions:

So the business rules are:

Extending the example

With the above definitions and precision it is possible to continue with further business rules related to other use cases (we could call the above for salary tariff specification). Examples of related cases could be:

Sune Vang-Pedersen Avatar

3 responses to “Business Logic/Rules Examples”

  1. […] The comprehensive package of “Semantic Modelling” is essential for the successful implementation of systems within a domain, as well as for capturing data across domains for reporting, low-coding, or data science activities. The provided diagram represents only a segment of the semantic model. Upon visiting the linked page, it becomes evident that there is substantial contextual information, but the business logic remains omitted. This is understandable as business logic is hard work and typically more relevant for implementation than for overview. For further insights into business logic documentation, I have authored a blog post available at Business Logic Documentation. […]

    Like

  2. […] Business Logic/Rules Examples […]

    Like

  3. […] Business Logic/Rules Examples […]

    Like

Leave a reply to Semantic Modelling – Exemplified – sunevangconsult Cancel reply