DEV Community

Charles Koffler
Charles Koffler

Posted on

Presentation of Clprolf, discussions

How do you design your classes?

Do you follow a method when you create a class?

Do you think its role should be obvious right away — even in the code, beyond just the class name?

And do you believe a language or framework could actually help with that?


Personally, I kept running into the same problems:

  • A class that was supposed to be “business logic” ends up mixing in low-level concerns
  • Layers get blurry
  • New devs ask: “What does this class even do?”

So I tried something. I made a tiny language where the role of a class is the first thing you write:

@Agent
public class OrderService {

    @With_compat
    private OrderRepository repo;

    public void checkout(Order o) {
        repo.save(o);
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)