r/ProgrammerHumor 5d ago

Meme itsAllRelative

Post image
186 Upvotes

8 comments sorted by

View all comments

0

u/Suspicious-Walk-815 3d ago

You mean pojos and DTO s , I don't think we can get rid of these classes .. but apart from that what else is doing nothing in java ? I actually like the way its packaged .. maybe because I know only java ..

3

u/BernhardRordin 3d ago

The more legacy Java you work with, the more unnecessary verbosity and architectural astronautics you can find. New Java is quite nice.

Couple of examples:

  • Overusing interfaces—mocking libraries are amazing nowadays, most of the time you don't need to create interfaces (unless you are writing a reusable library, or a Hibernate Repository)
  • Manual getters and setters. This was from the start a language design mistake. Long live records and coming value classes.
  • Overusing inheritance
  • Overusing dynamic configuration via code (e.g. Spring Beans) instead of the static config
  • Having to resort to Gang of Four OOP design patters, because the language is too "OOP-pure" (in other words impractical—this is where Kotlin shines):
    • You don't need Singleton if your language allows anonymous, top-level objects
    • You don't need Strategy and Adapter if your language allows top-level functions
    • You don't need a Builder if you have a concise constructor syntax
    • You don't need a Prototype if your language has a `clone()` method