3 ms·
I'm also pretty tired of "foo" and "bar". At the very least they teach nothing about the thought process that should go into naming things.
by robomartin 15y ago
I'm also pretty tired of "foo" and "bar". At the very least they teach nothing about the thought process that should go into naming things.
- FuzzyDunlop 15y agoThis is a huge annoyance for me, as is providing an example in the terms of 'A', 'B', 'C', and 'D'. PHP's manual is terrible for this. It's not just a naming problem, but a total failure to explain the purpose of that concept or function with a proper use-case. class A { public function a($a) { $this->a = $a; } } class _A extends A { } class B { public function b($b) { $this->b = $b; } } $foo = new A; $bar = new _A; $baz = new B; .... Another thing is stuff like this: Array.sort(function(a, b) { return a - b; }); Firstly, if you're a beginner, that means absolutely nothing other than an array is being sorted. Secondly, if you do know what it is, it fails to explain what else you might be able to do other than sorting from lowest to highest.
- Tycho 15y agoI hate 'foo' and 'bar.' To newcomers they probably conjure up ideas of sin/cos/tan rather than plainly represent placeholder names. 'DoSomething' or 'SomeFunction' or anything like that is prefereble.
- mhartl 15y agoI sympathize, but "foo" and "bar" are used when the name is beside the point—i.e., precisely when no thought process should go into naming things. See the entry on "metasyntactic variables" in the Jargon File more more information (http://www.catb.org/~esr/jargon/html/M/metasyntactic-variable.html http://www.catb.org/~esr/jargon/html/M/metasyntactic-variabl...).