📜 ⬆️ ⬇️

Names for metavariables

Meta - variables are substitute words that are used in technical texts to denote something that can stand in their place, meta-variables are often used in programming.

There are two legendary metavariables - foo and bar . They are beautiful - short, of the same length, different from each other, easily pronounced. But if we need more metavariables? There are no clear rules here. Baz and bat are commonly used. But they have a significant drawback - a very similar spelling with bar. And even more similar sounding (during performances, deaf letters at the end are often eaten and get “ba” instead of “bar” and “bat”)
 var foo = 'fooValue', bar = 'barValue', baz = 'bazValue', bat = 'batValue'; 


This resource has a huge number of programmers and I would like to suggest abandoning the tradition of using baz and bat as the meta variable variable, and also discussing the possibility of replacing them with something else.
')


I understand that this is already taking root as a tradition, but still, I do not understand where this tradition came from. In large blocks of code, where two or three similar variables are constantly used, confusion begins to arise, one has to read into each letter.

The proposal was made after discussion in the topic " JavaScript. Kernel ".

Why not come up with a foo-bar yet a set of names that would meet the following conditions:
- Length - three letters
- Radically different appearance
- Cardinally different pronunciation
- Easy and clearly pronounced. Must be 1 syllable.

For example, I suggest the following set:

 foo //  bar //  qux //  (  quux) os //  rol //  zed //  


Listen

Quux used because it is the traditional fourth variable, and sounds, IMHO, better than qux. But at the same time, it is knocked out of the "rhythm" of three-letter variables.
 var foo = 'fooValue', bar = 'barValue', quux = 'quuxValue', ose = 'oseValue', rol = 'rolValue', zed = 'zedValue'; // vs var foo = 'fooValue', bar = 'barValue', qux = 'quxValue', ose = 'oseValue', rol = 'rolValue', zed = 'zedValue'; 


Of course, at first they will be unusual, but over time, a set of different metavariables that look good in code will settle down. I would like to hear your opinion.

Source: https://habr.com/ru/post/112210/


All Articles