Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is anyone else bothered by the code at the beginning of this article? Simply returning the expression would have had the same effect, ie:

    function getDevJob(studying, hardWork, luck){
        return studying && hardWork && luck;
    }
I know that it might not make the code readable to novice javaScripters, but it bothers me anyway..


I'm more bothered because it's becoming "so clever" to put everyday life activities into a function. I saw code written in chalk on a sidewalk billboard at the door of a coffee shop yesterday. No, I will not reciprocate that cringe and verbally call a function to order my coffee because the barista learned Hello World the previous night.


Becoming? It's been this way since I first started hanging out in internet tech circles (eight years, longer I'm sure).


That's not even the biggest problem with this method. The name is totally wrong.


Yes.

It's a rhetorical device. And some could argue that code is also a rhetorical device.

But the only argument an if else block that returns true or false based on a boolean makes is "I'm not very good at this"


I immediately picked up on this, too. From the code I've seen, novice programmers tend to do this a lot more often than someone who has been programming for a while.

On a similar note, another thing novice programmers do often is rewrite min and max using if-else.




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

Search: