Porotype Notes from a Vaadineer

V-everything - important note about naming stuff in Vaadin

There seems to be a lot of misconceptions about naming conventions in Vaadin applications and add-ons, so I thought I’d better attempt to clear things up right away.

I’ll make sure the following is stated clearly in the upcoming Vaadin 7 tutorials and such, but it applies to v6 too, and is IMHO an important enough point to bring it up right away. 

There is a convention that some things (css classnames, client side widgets) in Vaadin are prefixed with the letter “v”. This convention is apparently often copied into add-ons and projects using Vaadin, but:

Please do not prefix your things with “v”, it is a scoping prefix intended for the Vaadin core.

Why? Consider the following:

In your project you name have some custom things that you need to style, and you give them the stylename “v-wrap”, and everything works fine. Then along comes Vaadin 7 (or some other new version, or a new add-on you want to use), and check it out: it also uses “v-wrap”, causing either a) your component to get styles you don’t want or b) causing your styles to be applied to the built-in element.

This is exactly the reason why the built-in stylenames are prefixed in the first place! It’s a scope, akin to package names and such, introduced to avoid naming conflicts. It avoids problems when introducing new stylenames, and avoids style-interference when embedding (e.g Liferay defines a lot of styles that could potentially interfere otherwise).

Instead of using “v”, please invent your own prefix (or no prefix, if you know this will not cause problems). The best would obviously be to have a fully qualified prefix (e.g com_vaadin), but that would be pretty long especially for the core components that are used extensively. 

As you can see, this is particularly important for stylenames, where style-interference can cause a lot of problems. 

As for the naming of java classes, the VComponent naming scheme is mostly a convenience. It becomes confusing and error-prone to have potentially three different things named “Button”: a server-side Vaadin component Button, a client-side Vaadin widget Button that extends the GWT widget Button. The need for a naming scheme like this depends a lot on what you’re doing, though. It’s a regular java naming problem, ymmv, do as you see fit - since java has proper packages, naming should not actually cause any fatal.

In summary: think twice before copying a naming scheme, and absolutely do not prefix your stylenames with “v-”.