This is how one of our junior devs solved a merge conflict

  • 27
    Ok I think we can tell if this key is set already 😫
  • 24
    Why || many times on the same param?

    And why not return isset...etc.?
  • 19
    Well we all started somewhere ...
  • 12
    /*My Eyes are bleeding*/
  • 22
    /*slow clap*/

    Probably would have worked just fine if *only* they checked to see if $query['pt'] was set another couple of times.
  • 29
    After 6 months he'll read that snippet and say "Oh my God, I can fix it!"

    nChecksToBeReallySure = 1000
    ret = False
    for i in range(nChecksToBeReallySure)
    ret = ret || bool(math.sin(isSet(...) * math.pi / 2))

    if ret:
    return True
    return not True
  • 2
    but why?
  • 14
    @SortaBubbly I don’t think any of us started here, lol.
  • 3
    Let’s not ignore the atrocious and misspelled function name.
  • 1
    good job for a junior dev
  • 5
    @SortaBubbly typically you start learning not to do this prior to employment
  • 1
  • 0
    Well, he went full retard
  • 0
    Defensive programming
  • 0
    @pher DOP: Defensive oriented programing
  • 1
    Did I miss the stage where I was a Jr dev? cuz I've never written code like that...
  • 5
    @billgates even as a Jnr you should know that the first isset() is the only one ever to be evaluated if it returns true for this conditional.

    So unless somehow you manage to have $query[‘pt’] be false, false, false, false,false, and then true without modifying it within the condition it’s useless and you really have done something beyond remarkable.
  • 8
    Oh how nice it is to be young and naive and young and naive and young and naive and young and naive.
  • 0
    Aaaah this reminds me of my first merge conflicts... good times
  • 2
    Is so cute XD
  • 1
    Hey, they are learning, tell them how to do it right, hit them with a whip a couple of times and they would learn!
  • 1
    Ask your junior to explain what the code does line by line.. Slowly..
Add Comment