Short "general" views naming vs long precise views naming....

Which one you prefer to use?

  • Option 1 : Short General Names, Like "label1", "Panel22", etc ... no reference table

    Votes: 1 11.1%
  • Option 2 : Same as above but with a table for reference, like "label1 - The Name of the game"

    Votes: 0 0.0%
  • Option 3 : Long specific naming, like "the_name_of_the_game_label"

    Votes: 8 88.9%

  • Total voters
    9

Cableguy

Expert
Licensed User
Longtime User
So...

Here I am again making noise....
I know this has been addressed before, but it's been awhile....

What do you guys prefer to use?

Option 1 : Short General Names, Like "label1", "Panel22", etc ... no reference table
Option 2 : Same as above but with a table for reference, like "label1 - The Name of the game"
Option 3 : Long specific naming, like "the_name_of_the_game_label"

So, a poll hey??
 

LucaMs

Expert
Licensed User
Longtime User
Not to mention that I'm an excellent typist, I write with 20 fingers ? ...

Short names were useful (or necessary) decades ago, when there were memory problems (even for sources) and there was no editor support (with B4X, I write "MyVar" and the next time just write M to get the MyVar text, by a TAB).

Generic names NEVER, NEVER, NEVER, NEVER, NEVER. Almost never short names, just very rare cases.
 

Alexander Stolte

Expert
Licensed User
Longtime User
exactly how I use them (almost, without underscore: xlblName, xpnlName, xclvName, ...)
my senior dev. do the same :D
must be the age.
Fun, your variant looks more legible, but one gets used to certain things.

I have already had to fight with my inner when I have to write with SQL instead of abbreviations, the full table name before the name...
 

LucaMs

Expert
Licensed User
Longtime User
my senior dev. do the same :D
must be the age.
Old school which has its important motives. Obviously your boss is almost as smart as I am ?

I have already had to fight with my inner when I have to write with SQL instead of abbreviations, the full table name before the name..
Never, again.

Product (table name, singular)
ID
Name
Price
...
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Began witth the first option to code, but after learning other languages and practices i am slowly migrating to the third option. Readability its key for team coding
 

Alexander Stolte

Expert
Licensed User
Longtime User
Why all those "p_" and "Product"? Since the table name is Product, "name", "price", "id" and the rest of the fields are of course of product, no need to specify them.
so that with complex queries you can see directly from which table the column comes. You often have foreign key relationships because you have columns in your table from other tables, which are then linked.

Example:
Table: Users
u_id
u_name

Table: Messages
m_id
m_message
u_id

Table Users are connected with table messages via the User Id.
According to your syntax it would be in the table "Messages" then 2 times the name "ID", which does not work ;)
 

cklester

Well-Known Member
Licensed User
so that with complex queries you can see directly from which table the column comes. You often have foreign key relationships because you have columns in your table from other tables, which are then linked.

Like Luca, I generally don't use prefixes in my field names. For your sample case, I would do this:

Table: Users
id
name

Table: Messages
id
message
user_id

If there are ever any conflicts in my foreign key queries, I just use "As".
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Example:
Table: Users
u_id
u_name

Table: Messages
m_id
m_message
u_id
i do not like it, because it is redundant.

B4X:
table users
id
name

table messages
id
user_id
text

select u.id
          ,  u.name
          , m.text
FROM Messages as m
INNER JOIN users as u on m.user_id = u.id
i dont polute my tables with extra redundant information and my queries still look readable and beautiful!
 

Cableguy

Expert
Licensed User
Longtime User
Option4 : xlbl_yourname, xpnl_yourname, xbtn_yourname
This kind of naming, to me, falls into the 3rd option as it is a more specific naming, even if not too long
 

AnandGupta

Expert
Licensed User
Longtime User
I agree with klaus and Alexander Stolte as I use same technique.
<variable type><used as>
lblAge, dToday, nAmount

This helps me to understand the variable at a glance.
 
Top