17

I am an intern getting paid $25/hour for fullstack web development. Their brand new full time frontend web developer, getting paid at least $75,000/yr, just wrote these lines of code:

if(this.ackBy !== null && this.ackTime !== null)
this.acknowledged = true;
else
this.acknowledged = false;

This. Is. Far. From. His. Worst. Code. This isn't even surprising to me. How does this incompetence find work in this field

Comments
  • 13
    Well, it works. You can always discuss semantics. Also, I might do this if I want to add a breakpoint on only one condition, but could forget to optimize later
  • 8
    Well.. he does only get paid $75k. Don’t expect much.
  • 4
    I really believe that developers who prefer 'if (condition) thing = true; else thing = false;' over the obvious simple alternative either do not understand boolean logic, or presume that others working on their codebase cannot be expected to.

    Either way, it is a bad sign.
  • 5
    So, how'd you do it? I'd do it like this myself...
  • 2
    (keep in mind that I don't know any context, just seeing this little piece of code)
  • 2
    Wish I were being paid $25 😅 only get half of that... Still in college though, so not sure how much I can expect
  • 2
    @linuxxx Similarly, missing context, but why would one not simply write the following?

    this.acknowledged = this.ackBy !== null && this.ackTime !== null;
  • 3
    @halfflat No clue, I'm mainly a php dev and Linux engineer, have done quite some JavaScript but it's not my specialty :)
  • 1
    $75k/y in NY is pretty entry-level.
  • 1
    @Avyiel for CS internships in NYC it's pretty standard
    @bahua it's an entry level position in NYC
  • 1
    @halfflat that's where my mind goes too... This is just an easy example, he's shown himself to be incompetent in Plenty of other ways
  • 0
    @Cheeseypi Did you see my comment? Genuinely wondering :)
  • 3
    You know what I like:

    bool b = (expression)
    ? true
    : false;

    100% serious btw, please burn me at the stake because I wasted two lines of vertical space
  • 0
    @linuxxx which? The way @halfflat would do it is how I would too
  • 2
    @Cheeseypi That looks more efficient indeed but I wouldnt call the other solution entirely crap; it's a little longer but it works and does its job without much overhead :)
  • 1
    @linuxxx it's not so much that code as that code is an example of the thoughtlessness that goes into the rest of his work
  • 3
    A} $75k is not much
    B} give a dozen developers a task and you'll likely get 11 solutions that work, some more 'elegant' than others... but that's a fuzzy-assed bit of criteria
    C} someone mentioned debug which I find valid use
    D} not knowing what refactoring, code review, or even what role this code plays in whatever application, etc have or haven't taken place, comments on code quality are premature
  • 0
    @ModernShoe I was wondering why you newlined
  • 1
    @tmpnull expression is easier to read with the second part of the operation out of the way
Add Comment