DEV Community

Cover image for Java Is Modern—So Why Does It Still Feel Verbose?
anand jaisy
anand jaisy

Posted on

Java Is Modern—So Why Does It Still Feel Verbose?

Java’s six-month release cycle has significantly accelerated its evolution, transforming it into a more modern and capable platform. Java has long been recognized as the backbone of enterprise applications, valued for its stability, performance, and widespread adoption.

With recent advancements, Java has unquestionably modernized. However, developers still perceive certain aspects—particularly verbosity and boilerplate code—as excessive when compared to other programming languages.

A common example is entity modeling using Spring Data or Micronaut Data with JPA:

@Entity
public class Role extends EntityMetadata {
    private String name;
    private String description;

    // Create getter/setter constructor and other things
}
Enter fullscreen mode Exit fullscreen mode

In such cases, developers are required to manually write getters, setters, constructors, and other boilerplate code.

Lombok as a Solution

Lombok addresses this issue effectively:

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
public class Role extends EntityMetadata {
    private String name;
    private String description;
}
Enter fullscreen mode Exit fullscreen mode

By leveraging Lombok, developers can significantly reduce boilerplate, improving readability and productivity.

Trade-off:
The primary drawback is the reliance on a third-party library, which some teams prefer to avoid for long-term maintainability or tooling reasons.

Records and Their Limitations

In many Java conference talks and community discussions, architects often recommend using Java records. While records are a powerful addition, they come with limitations—especially in enterprise contexts.

For example:

@Entity
public record Role(String name, String description) extends EntityMetadata {
}
Enter fullscreen mode Exit fullscreen mode

Records cannot extend other classes (they implicitly extend java.lang.Record), making them unsuitable where inheritance is a core part of object-oriented design. Additionally, records do not integrate well with JPA, which expects mutable entities and a no-argument constructor.

Quarkus Approach

The Quarkus team has introduced an interesting and developer-friendly alternative:

@Entity
public class Role extends EntityMetadata {
    public String name;
    public String description;
}
Enter fullscreen mode Exit fullscreen mode

By allowing public fields, Quarkus generates the necessary accessors and other infrastructure behind the scenes. This approach reduces boilerplate without requiring additional libraries, offering a compelling balance between simplicity and productivity.

We all know there are lots of project going on with JAVA platform, however these small things make huge difference in developer adoption. That why JAVA is still famous for too much verbosity and boilaplate code.

The Java ecosystem continues to grow, with numerous frameworks and platforms actively evolving. However, seemingly small concerns—such as verbosity and boilerplate—have a significant impact on developer experience and adoption.

Top comments (0)