Live data from Hacker News

New Grad vs. Senior Dev

ericlippert.com

11–20 of 392 posts

Re: New Grad vs. Senior Dev

#11
Oh god. That meme.

I've seen it a day or two ago. Can't find the picture anywhere now (I've seen it in some group chat). Anyway, beyond the words quoted at the beginning of this article, the meme's "nested loops go brrr" had a picture of a triple-nested loop using Active Record to do some simple database operations.

To which the correct response is: "it's a 'senior developer' in an industry where you get called a 'senior' after a total of 3 years of experience doing programming; don't do stupid shit like this, just use SQL like it's meant to".

Re: New Grad vs. Senior Dev

#12

Can someone explain the bugs in the code samples? The author says they're there but I honestly can't find them.

No checks regarding length of source and query - may end up dereferencing beyond the bounds of the string.

Re: New Grad vs. Senior Dev

#13

I dislike the mentality that one must "struggle" to be patient with new devs and that it's "more than they deserve." Is it really so hard to help other people learn, and to accept that the only advantage you have on them is starting earlier?

I take your point, but let's be fair. My attitude was "this code is bad and I'm going to demonstrate my skill by improving it" when it should have been "please teach me what design and implementation concerns went into the choice of algorithm here". I was lucky to get a gentle and thoughtful correction for my presumptions.

Re: New Grad vs. Senior Dev

#14
post #7

I find that the biggest misunderstanding happens because "new grads" (and I happen to be one) confuse _asymptotic complexity_ with actual complexity. I'm not sure sure why, but CS courses and interview questions mostly focus on _asymptotic complexity_ and usually forget to take into consideration the complexity for "little values of n". And funnily enough, in real life n never goes to infinity! In a strict sense big…

To be fair, in my experience it is often the case that asymptotic complexity is a good proxy for real-world performance, even for small values of n. Not always, but often.

I think it's fine that the academic courses focus a bit more on what's better in theory than in practice, because there are always caveats to "in practice"; the person who writes the special-purpose genomics libraries was also once a new grad.

Re: New Grad vs. Senior Dev

#15
post #7

I find that the biggest misunderstanding happens because "new grads" (and I happen to be one) confuse _asymptotic complexity_ with actual complexity. I'm not sure sure why, but CS courses and interview questions mostly focus on _asymptotic complexity_ and usually forget to take into consideration the complexity for "little values of n". And funnily enough, in real life n never goes to infinity! In a strict sense big…

When you do big O analysis you get best case, worst case, and average case. You have to do some thinking about the structure of you data when doing big O analysis.

Re: New Grad vs. Senior Dev

#16
post #12

Can someone explain the bugs in the code samples? The author says they're there but I honestly can't find them.

No checks regarding length of source and query - may end up dereferencing beyond the bounds of the string.

There is a dereference past the bounds of the query in one case in the last code sample, but there is no deference beyond the bounds of the source string.

You're probably thinking in C# or Java; remember that in C the convention is that a zero char ends strings. If the source string is shorter than the query string then the code will encounter a zero char in the source string at the same time as it encounters a non-zero char in the query string, and the inequality will end the loop before the beyond-bounds dereference.

There are other defects; can you find them?

Re: New Grad vs. Senior Dev

#17
post #12

Can someone explain the bugs in the code samples? The author says they're there but I honestly can't find them.

No checks regarding length of source and query - may end up dereferencing beyond the bounds of the string.

There are though, when it checks for '\0'.

`starts()` looks like it's not checking if len(source)

   if (source[i] != query[i])
      return false;
will evaluate to

   if ('\0' != 'b')
      return false;
so `starts()` will correctly return false.

Always if len(source) len(source).

Re: New Grad vs. Senior Dev

#19

I dislike the mentality that one must "struggle" to be patient with new devs and that it's "more than they deserve." Is it really so hard to help other people learn, and to accept that the only advantage you have on them is starting earlier?

Learn on their own they must.

Re: New Grad vs. Senior Dev

#20
Of course, if this code were running in a server, or if it were part of a library that was widely used, then suddenly you have the potential for a DoS vulnerability.

The narrative would then be that the microseconds you saved all those devs over the years were wiped out when hackers took down your system.

Post reply on HN