Should I give the backing beans another name than the class?

110 Views Asked by At

Should I give the backing beans a new name in the @Named annotation, or should I use the same as the class for readability? Are there any guidelines on when to not or when to do this?

I have a backing bean that provides a dropdown component with values. It is used multiple places and is read only so I made it application scoped. I named it StatusValuesManager.

1

There are 1 best solutions below

0
On

It's very subjective, but there are some points to analyse:

  1. Conflict: Does this backing bean has a name too generic that another component, system or package that can use the same name?
  2. Usability: If it is constantly used, has it an easy, not too long and significant name that can be used with readability?
  3. Tracking: If I replace the class name in the annotation, am I making the tracking to it more difficult?

I personally like to give a great name and don't override it, so I can track it easily. And I think about the possible conflicts and usability when I create a backing bean, so it will receive a name that won't have any conflicts, nor too complicated, nor too generic.

Talk to people from your project about some best practice and good luck in advance.