Live data from Hacker News

Programmers can’t write algorithms without help

queworx.com

91–100 of 105 posts

Re: Programmers can’t write algorithms without help

#91

Earlier quoted context omitted.

>Yes, they're incompetent. So you feel confident in asserting that, at the time that the person made that tweet, the quality of the Python code that they shipped was poor, or it took an inordinate amount of time to produce? All because they had to look up len()?

Actually, yeah. That one jumped out at me, too: that’s kind of like saying “I know how to drive a car, but I always have to look up which one is the gas pedal and which one is the brake”. If you’ve done _anything_ in Python, the length function is ingrained in your brain, so if you honestly don’t remember it, you just haven’t written any Python (or it’s been more than 10 years).

>that’s kind of like saying “I know how to drive a car, but I always have to look up which one is the gas pedal and which one is the brake”

OK, I agree, it's kind of like saying that.

But it's also kind of not like saying that.

Incompetence in driving and incompetence in software development are measured in completely different ways for completely different reasons. In driving, notions of what you definitely should know in order to qualify as "competent" extend from the intrinsic risk to other people's well-being. You can't simply transpose those notions onto the low-stakes sandbox environment that is software development. In software development, process is only important as far as it hinders or helps to deliver good code; competence should be dictated purely by results. All of the actual competence of driving comes during the actual process part; successfully reaching your destination is actually considered to be less important than simply not fucking anything up on the way there.

Sometimes I pick up a video game that I haven't played in weeks, and perform actions incorrectly because the button layout has been overwritten by the button layout of a similar and more recent game. It would foolish to say I'm wholly incompetent at either game; I still have a strong concept of what I should be doing and what I intend to do, it's just that I'm fumbling a bit at the specifics of executing my intent. Am I incompetent for looking up the button layout? Am I incompetent, but only for the 1 hour that it takes me to get back in the groove of things?

Declaring someone is incompetent is a bold assertion to make from such limited information. At the end of the day you either deliver good code in good time or you don't. I would be extremely reluctant to determine this guy can't deliver good code because he had to look something up. Figures no one will hire me.

Re: Programmers can’t write algorithms without help

#92
post #91

Earlier quoted context omitted.

Actually, yeah. That one jumped out at me, too: that’s kind of like saying “I know how to drive a car, but I always have to look up which one is the gas pedal and which one is the brake”. If you’ve done _anything_ in Python, the length function is ingrained in your brain, so if you honestly don’t remember it, you just haven’t written any Python (or it’s been more than 10 years).

>that’s kind of like saying “I know how to drive a car, but I always have to look up which one is the gas pedal and which one is the brake” OK, I agree, it's kind of like saying that. But it's also kind of not like saying that. Incompetence in driving and incompetence in software development are measured in completely different ways for completely different reasons. In driving, notions of what you definitely should k…

> I would be extremely reluctant to determine this guy can't deliver good code

See, I’d be extremely reluctant to assume the opposite - that he can, even though he doesn’t remember “len”. Given this one bit of information, all I know is that he has exactly one thing in common with everybody who doesn’t know how to program in Python: he doesn’t know the function for determining the length of a string. Now, he may (somehow?) know everything else about Python except for that one thing: I’m assuming the interviewer was a bit surprised (as I would be) that somebody presenting themselves as a Python programmer didn’t know len, but went ahead and asked him a few more questions which he may well have nailed. If the answer to every question was “I don’t know, I have to look it up”, you’d pass on him, too. I just can’t picture how anybody who didn’t remember that could remember much else, but I guess that’s why job interviews last an hour or so.

Re: Programmers can’t write algorithms without help

#93
post #52

Earlier quoted context omitted.

The first time I heard the problem of detecting a circular link in a linked list, I figured out the tortoise/hare solution in probably 15 minutes without having heard it before, so it's not impossible.

You should have written a paper.

I was hardly the first person to figure it out.

Re: Programmers can’t write algorithms without help

#94

Earlier quoted context omitted.

I picked bubble sort, because it's literally the example from the first sentence of the article: > David Hansson, the creator of Ruby on Rails, admitted in a tweet that he wouldn’t be able to write bubble sort on a whiteboard.

Oh my, I’m that guy today. Whoever said it, I have a super hard time believing DHH couldn’t implement bubble sort on a whiteboard. Am I the only one? I get that people hate whiteboard/algorithm interviews, but bubble sort? for i = 0..n: for j = i..n: if arr[i] > arr[j]: arr[j], arr[i] = arr[i], arr[j] Everyone in this field should be able to do this, maybe not right away, maybe not without bugs, but with help within…

Now I get to be that guy. Your i only needs to go to n-1, and your j can start with i+1.

More importantly, what you wrote is a selection sort, not a bubble sort!

A bubble sort swaps neighboring terms. Eg, if I interpret the code in 2.1 of https://users.cs.duke.edu/~ola/bubble/bubble.html correctly, the 'definitive' version is:

  for i = n-1..0:
    for j = 0..i:
      if arr[j+1] 

Re: Programmers can’t write algorithms without help

#95
post #91

Earlier quoted context omitted.

>that’s kind of like saying “I know how to drive a car, but I always have to look up which one is the gas pedal and which one is the brake” OK, I agree, it's kind of like saying that. But it's also kind of not like saying that. Incompetence in driving and incompetence in software development are measured in completely different ways for completely different reasons. In driving, notions of what you definitely should k…

> I would be extremely reluctant to determine this guy can't deliver good code See, I’d be extremely reluctant to assume the opposite - that he can, even though he doesn’t remember “len”. Given this one bit of information, all I know is that he has exactly one thing in common with everybody who doesn’t know how to program in Python: he doesn’t know the function for determining the length of a string. Now, he may (som…

>See, I’d be extremely reluctant to assume >Given this one bit of information, all I know

This seems like a really flawed way of approaching most things. Why assume anything? And if you're going to assume anything, why only factor in that one bit of information, and not any other context. How about the fact that he's been coding for 30 years and works at Google. Is that also relevant?

>I’m assuming the interviewer was a bit surprised

There was no interviewer in this situation. His tweet was not in regards to any interview. Did you read the article?

>If the answer to every question was “I don’t know, I have to look it up”, you’d pass on him, too.

But if I were to do so, at least in such a case I would be basing my suppositions on more than just one thing.

Re: Programmers can’t write algorithms without help

#96
post #89

Earlier quoted context omitted.

> Consider that when athletes are scouted, they are usually not asked to play in a full game of their sport. But instead certain stats like 'how fast can he run 100m' and 'how high can he jump' are used. Teams rarely sign players based solely on measures like this, and those that do frequently regret it. Additionally, the nature of contracts in professional sports are very different from regular employment. Players a…

I know. It's just an analogy. You can replace it with a better one if you want. The general point I am making is: these are not trying to measure actual job tasks, but instead measuring something that (they hope) is closely related to, or correlated with one's ability to perform the job. The idea is that if one can do these sorts of problems, one can probably do the actual job at hand.

> (they hope) is closely related to, or correlated with one's ability to perform the job. The idea is that if one can do these sorts of problems, one can probably do the actual job at hand

This is a claim about the intentions behind these practices.

Intentions aside, the whole point of this perennially recurring discourse is about effectiveness — that certain overused methods of filtering job candidates are ineffective on their own terms — and negative side effects — that they're biased against people with non-traditional / from underrepresented backgrounds.

Re: Programmers can’t write algorithms without help

#97
post #26
post #2

> Programmers can’t write algorithms without help And that might be a good thing. How often does a normal software engineer have to write bubble sort from scratch in his daily life? If someone from my team came to me telling me he had to sort an array and wrote bubble sort from scratch, then I'd probably not be very happy with that unless there is a really good reason to spend that time on it rather than using an exi…

I've been a developer for almost 2 years (I know not that long) but I have never even heard of bubble sort. Looking it up, it is O(n^2). Is there a reason this is a common interview question? It doesn't seem like a sort one would ever really use, or at least it has very obscure uses. I always thought merge/quick sorts accounted for 99.9% of use cases and only ever really learned about those.

I guess it's a common question because it's usually taught in college because it's probably the simplest after select sort.

Personally I've never found this case myself, but regarding why it's used some times, the O(n²) is the worst case scenario. The best case scenario is O(2n) which is really good, so for lists that are sorted or almost sorted it works well.

Other algorithms like timsort have O(n) for the best case scenario, but O(n) only tells you how many times you go through the loop. Without actually measuring it, I would expect each iteration of timsort to be at more than twice as expensive as bubble sort, so in this case O(2n) would be cheaper than O(n).

When you know with a certain degree of certainty how is the data you expect in most cases, some times it's kinda easy to make a more efficient algorithm than the one that is the best for the average scenario.

Re: Programmers can’t write algorithms without help

#98
post #94

Earlier quoted context omitted.

Oh my, I’m that guy today. Whoever said it, I have a super hard time believing DHH couldn’t implement bubble sort on a whiteboard. Am I the only one? I get that people hate whiteboard/algorithm interviews, but bubble sort? for i = 0..n: for j = i..n: if arr[i] > arr[j]: arr[j], arr[i] = arr[i], arr[j] Everyone in this field should be able to do this, maybe not right away, maybe not without bugs, but with help within…

Now I get to be that guy . Your i only needs to go to n-1, and your j can start with i+1 . More importantly, what you wrote is a selection sort, not a bubble sort! A bubble sort swaps neighboring terms. Eg, if I interpret the code in 2.1 of https://users.cs.duke.edu/~ola/bubble/bubble.html correctly, the 'definitive' version is: for i = n-1..0: for j = 0..i: if arr[j+1]

Fair point. Perhaps it is harder than I thought without looking anything up or testing? At least to get the canonical version written down.

Re: Programmers can’t write algorithms without help

#99
post #6

Yet another article showcasing how the tech interview process is fundamentally flawed. Personal anecdote: I recently underwent an interview process for a position in my field of expertise (computer vision) consisting of multiple in-person stages, whiteboard coding, product design and a take-home assignment that required developing a foundational (bubble-sort like) algorithm from scratch. After successfully completing…

I recently interviewed for a job running a kubernetes cluster. I have two years of experience running a kubernetes cluster, including writing a custom provisioner and several controllers in go.

They spent two hours doing coding interviews and 15 minutes asking me about kubernetes, if that.

Re: Programmers can’t write algorithms without help

#100
In theory, algorithms are an important aspect of CS. Having learned about them plus some experience, enables the logical thinking mindset required to develop better code. In practice, algorithms are hardly useful, either because T&M don't allow it, or the problem gets escalated when adding dependencies to existing code and services. In theory, some CS, algorithmic or systems thinking background may be that crucible required to avoid many known pitfalls and rabbit holes. In practice, developing and maintaining IT systems have nothing much in common with sports. This being something more of a distraction by ignorance and management, than anything of tangible value to people and environment.
Post reply on HN