Thursday 17 November 2022

Java Beans

Back when I was young and innocent, and when I started learning about Beans. Java Beans, Java Bean Conventions, EJB Beans, and all that, I started writing Beans.

So I ended up with a lot of classes called ItemsBean, UsersBean, etc.

I visited this admittedly old code, and immediately thought, "What was I thinking?!?".

A Bean, though most veteran Java Programmers have an incling what it is, does not provide ANY meaning to people outside the Java field. Even for Java people, it doesn't explain a lot.

This is a naming scheme where a lot of people completely got it wrong.

Sure, Beans is cute and funny in combination with Java (coffee, in case I have to spell it out.)

So, paraphrasing Uncle Bob here:

“Don't be cute.”
- Uncle Bob (Robert C. Martin)

Unfortunately, we're kinda stuck with the naming scheme for now. I will just point everyone to the magical file "beans.xml" that is supposed to just exist in a certain place, to make magic happen.

Don't get me wrong. I love Java. But, admittedly, sometimes it's weird...

References

Clean Code - Chapter 2 - Meaningful Names (Robert C. Martin)
http://cleancoder.com/

No comments:

Post a Comment