Remix.run Logo
never_inline 2 days ago

> by-product of Java's strict type system

1. Lack of first class functions till Java 8 is one reason old APIs are horrible with inheritance and reflection everywhere. You had to extend class and override methods even for simplest of tasks.

After Java 11 the code is much more succinct and functional style. But old libraries remain.

There are places where the overextensibility these libraries provide is useful. But those are few.

2. the annotation processors were late to the game - so many libraries which need to inspect object structure (such as serialization) were written with heavy use of reflection.

I will give you an example of how frameworks designed for "modern" Java look like.

Micronaut has something called Micronaut data JDBC - in which you just declare methods with few annotations eg `List<Book> queryTop10BooksByYear(int year)` and it will auto generate the JDBC + SQL code and handle injecting it into your service. The returned object can be a POJO without all the Proxy object circus ORMs come with. I haven't seen something as easy in Python yet. And all this happens in compile time with an annotation processor.