Skip to main content


I wish that annotations in #Java-based languages where designed more like decorators in #Python.

It’s much more ergonomic to have decorators designed as functions/functors rather than static annotations.

The answer to the question “how do I get my @authenticate decorator to run some custom logic before a decorated function is run in Python?“ is simply “create an authenticate function which wraps your function“.

If the same question is asked for Java/Kotlin, the answer would be more like “extend a generic annotation interceptor/processor, usually provided through an external framework, or coded and managed by yourself, configure it with the accepted annotation interfaces, and implement the process method“.

The whole idea that a decorator ought to be an interface with no business logic attached rather than an abstraction that exposes a functional interface has severely limited the adoption of an otherwise powerful programming feature. And it has forced many projects to reinvent the pattern of the custom annotation interceptor many times over.

@programming