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

The other 2 devs on my team (both senior to me) routinely check in code like this:

  function(filename) {
    if (!filename) {
      this.setState( {x : null});
    }

    var s = filename;
    if (s) {
      this.setState({y :''});
    }
    else {
      this.setState({z: false});
    }
  }
Which to me is unfinished code (I truncated variable names). I always try to cleanup my code before checking in, probably to my detriment. They both are much faster at pushing features out. But god, some of the code is just unreadable. Also--no comments. For some reason everyone at my current company refuses to use comments.

And I've seen plenty of:

  x == true ? true : false
ternaries, though in javascript, these are not necessarily redundant and are easy to mistake. A couple other favorites I've seen:

  if (x == 'true') ...
and

  var data = {option: 1}
  var context = this;
  this.someMethod.bind(this, context, data, data.option)


Wow. Or rather, !wow.

Such practices are all too common ... should be the rare exception, really.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: