Argiropoulos Stavros
Argiropoulos Stavros

Reputation: 9533

Suggestions on naming components in java and not only

What should be the convension while naming components and why? E.g

EDIT: When typing i.e. on netbeans and using code completion with ctrl+space if you choose the second naming convension then typing "button" results on a sorted list of all your buttons.

Upvotes: 1

Views: 126

Answers (3)

starblue
starblue

Reputation: 56822

I would choose myJobButton, because it is the way you would call it in English. The other version looks forced and unpleasant to me.

It is much more important that the code is easy to read than that it is easy to write.

Upvotes: 1

Etaoin
Etaoin

Reputation: 8744

As long as you're consistent, and as long as it's clear what your identifiers mean, it doesn't matter -- there's no single overarching standard for this sort of thing. If you're working on a project by yourself, do whatever makes the most sense to you; if you're working on a team, settle on a convention and follow it. In general, though, you've got more important things to worry about. :)

Upvotes: 2

Paul Whelan
Paul Whelan

Reputation: 16799

have a look here from the sun site.

extract

Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.

Upvotes: 0

Related Questions