DEV Community

Charles Koffler
Charles Koffler

Posted on

Getting Started with Clprolf: Structuring Responsibilities in OOP

Making Responsibilities Explicit

Clprolf is a language and framework designed to make architectural roles explicit.

In most object-oriented systems, separation of responsibilities relies on discipline.

Clprolf encodes that discipline structurally.

Every class declares what it is.


1️⃣ Declaring a Role

Instead of writing:

public class OrderManager { }
Enter fullscreen mode Exit fullscreen mode

In Clprolf you declare the role:

public agent OrderProcessor { }
Enter fullscreen mode Exit fullscreen mode

or

public worker_agent OrderRepository { }
Enter fullscreen mode Exit fullscreen mode

Each class has a declension (its architectural nature).

The core declensions are:

  • agent → business responsibility
  • worker_agent → technical execution
  • model → passive domain entity
  • information → technical data container
  • indef_obj → transitional, undefined role

2️⃣ Start Flexible: indef_obj

Clprolf does not require architectural clarity upfront.

You can begin with:

public indef_obj OrderManager {
    public void process(Order order) {
        validate(order);
        save(order);
        notify(order);
    }
}
Enter fullscreen mode Exit fullscreen mode

indef_obj represents a temporary state.

Refactoring can happen later.


3️⃣ Making Responsibilities Explicit

After identifying responsibilities:

Concern Nature
Business validation Business
Persistence Technical
Notification Technical

You refactor:

public agent OrderProcessor {
    private OrderRepository repository;
    private OrderNotifier notifier;

    public void process(Order order) {
        validate(order);
        repository.save(order);
        notifier.notify(order);
    }
}
Enter fullscreen mode Exit fullscreen mode
public worker_agent OrderRepository { ... }
public worker_agent OrderNotifier { ... }
Enter fullscreen mode Exit fullscreen mode

The behavior is unchanged.
The architecture becomes explicit.


4️⃣ Structural Rules Are Enforced

Clprolf does not only suggest discipline.

It enforces structural coherence.

Example:

public agent A1AnimalImpl nature AnimalWorker { }
Enter fullscreen mode Exit fullscreen mode

This attempts to inherit a worker_agent from an agent.

Result:

ARCH-A1 => Class A1AnimalImpl:
the mother Class should be an agent (AnimalWorker)
Enter fullscreen mode Exit fullscreen mode

The equivalent Java code would compile:

public class A1AnimalImpl extends AnimalWorker { }
Enter fullscreen mode Exit fullscreen mode

Clprolf rejects it as architecturally inconsistent.


5️⃣ Interface Discipline

Clprolf also distinguishes between:

  • version_inh (alternative implementations)
  • capacity_inh (shared capabilities)

Example of forbidden usage:

public agent BA4Animal contracts Animal, Vehicule { }
Enter fullscreen mode Exit fullscreen mode

Error:

ARCH-BA4 => contracts multiple version_inh interfaces (forbidden)
Enter fullscreen mode Exit fullscreen mode

The rule prevents ambiguous role inheritance.


6️⃣ What Clprolf Changes

Clprolf does not change:

  • algorithms
  • execution flow
  • runtime model

It changes:

  • role visibility
  • inheritance coherence
  • architectural guarantees

7️⃣ Philosophy in One Sentence

Clprolf encodes architectural responsibility at the language level
instead of leaving it to convention.


Top comments (0)