What Is Bar?
When you're programming, you have to use a lot of variables to store data and perform calculations. You can't just call them "foo" or "bar" because then your code would be really confusing. So, what do you do? Well, you can use arbitrary names like "foo" and "bar", but that's not very helpful for anyone else who has to read your code. You could also use a more descriptive name, but that's wordy and boring. That's why programmers use metasyntactic variables (or MSV). These are just random names that stand in for stuff in your code—they don't mean anything at all. They're just there so everyone can read the code more easily! The bar is a placeholder used to replace foo in many places, but it should be noted that this is not the first time it has been used. It is no coincidence that bar is also a military term meaning "to make something or someone completely useless." In fact, the use of a bar as a placeholder comes from the use of another such placeholder: Foo. Foo is one of the earliest popular placeholders used in technology. For example, foo is used to name generic variables in a learning environment. As developers continued to use foo, some began using the bar as a second placeholder, partially because of the military term fubar, which has a different meaning and connotation. As a placeholder, the bar is somewhat controversial because unlike foo (which means nothing), it actually has meaning in English. Many developers who are native English speakers prefer to use placeholders (like foo) with no inherent meaning, such as ack or qux. However, because of its short length and multiple uses by other languages (such as German), the bar meets another common placeholder criteria: three letters are preferable over longer strings.
Related Terms by Software Development
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.