Hacker News new | past | comments | ask | show | jobs | submit login

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.



This 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.


I 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.


I 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-variabl...).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: