24

New developers(5-6 years experience) these days are so pathetic. They dont have any sense of code review. All they want is to put their opinion out without giving any thought.

I had a PR for review today which contains mock specification to match a regular expression and return the corresponding response

The regular expression I put was

104000(02|06|20|48)

Now, this guy comes and puts a comment that we could "simplify" as 104000\d{2}

I replied, the ending digits are not contiguous. The specific pair of digits have to match for these mocks.

Then this guy replied, then we could simplify as 104(0{4}(2|6)l0{3}(20|48)).

I said, I cannot understand how that is simplification. Why do we need such a complex regex to match something very straight forward.

And the guy replied, we should be writing proper regexes, otherwise we could just specify everything explicitly.

I was like WTF man. You try deciphering this next week without taking at least a minute to know which values are matched.

Anyhow, another senior person approved my PR, and I merged it.

Comments
  • 2
    Was he a "Cripto-engineer"? Dying! haha.
  • 2
    I understand that because I wrote a library to build regexes. But I wrote a library to build regexes because regexes.
  • 2
    A big benefit of code reviews are that the reviewers learn from it. I hope he does.
  • 4
    I used to be like that too.

    When you finally learn to juggle the technology it's hell of a fun to do so with every nail you see
  • 3
    Looks like that guy wanted to show off his regex skills.
    And typically those kinds of people don’t care about readability. The more complex and unreadable the regex is, the better, because it looks so cool! And that’s why we are 1337 haxx0rs, right?
  • 3
    @Lensflare You're wrong.

    It's 13{2}7 h[4a]x{2,3}0r[sz]?
  • 7
    To be fair, I can see how someone might encounter regex and come away with the mistaken impression that you're supposed to make them as ugly and confusing as possible.

    At least, I hope that's a mistaken impression.

    It is, right?
  • 3
    > Resolve discussion
    > Merge
  • 4
    Reminds me of people "simplifying" a ton of if-else statements into one ternary... Ew
  • 3
    "otherwise we could just specify everything explicitly."

    BRO WAS SO CLOSE TO GETTING IT
  • 4
    If you just have 4 cases, I wonder if 4 simple == would have been better.

    10400002 || 10400006 || 10400020 || 10400048

    If you match specific numbers, it's nice if you can do a search in the project and find the specific number.
  • 1
    Yeah... I mean if you're really into regexs, sure... But that's certified dumb to do if others are not going to be able to read it.

    He just wants to feel better about himself because he "knows" regex.
Add Comment