Live data from Hacker News

Competitive programming is useless

kislayverma.com

121–130 of 157 posts

Re: Competitive programming is useless

#121

I'd disagree with this assessment. In my own experience, I've found that competitive programming is useful in teaching a few skills. However, the apparent point of competitive programming--building up a good repertoire of advanced algorithms and data structures--is pretty close to useless. In my professional career, the most complex algorithm I've ever had to code myself is ... union-find (on like two occasions), wit…

To me competitive programming doesn't make you a good software engineer. It will teach you bad practices, like abusing of dangerous programming constructs or data structures to optimized the code or just save some typing while writing the code (like one letter variable names, macros, etc), global variables and state in the program, not using common design patterns, not using OOP, not documenting the code and in gener…

> It will teach you bad practices

Agreed, everything that makes good contest code is a bad thing for production code. In a contest you just want to hack together something as quickly as possible, it only needs to work once, will never be maintained or documented.

It's all good fun as a sport, but nobody should consider it relevant to working on production code.

Re: Competitive programming is useless

#122

Earlier quoted context omitted.

No? If you check your own sources, you will find that this is precisely the type of case where a developer is using an O(n^2) algorithm out of ignorance when they should have been using a faster algorithm, and that the high load time was caused by this mistake. The time complexity for bubble sort is also O(n^2), compared to O(nlogn) for reasonable sort algorithms. I don't really understand how you take all this infor…

The way accidental O(N²) comes about isn't "I'm intentionally using an algorithm that's O(N²)" (e.g., bubble sort), but "this method that I think is O(1) is actually O(N)" (whether because it's badly designed or just badly documented). It's really not in the same vein as using bubblesort instead of a mergesort: failures aren't in algorithm design but in the actual mechanics of the implementation that is ancillary to…

> failures aren't in algorithm design but in the actual mechanics of the implementation that is ancillary to the algorithm itself.

Strongly disagree. The GTA developer basically designed an algorithm which loops items in an array, and for each iteration in the loop, they parse the entire JSON that contains all items, and they do lookups for duplicates from an array instead of from a set. This is like a quintessential example of an algorithm design failure, so it seems weird to me that you're not attributing it to a failure in algorithm design, but instead you pass the buck to creators of the library that the developer was using. Sure, the library methods could have been documented better, or implemented differently, or whatever, but that seems like an entirely unrelated discussion.

> "this method that I think is O(1) is actually O(N)"

I'm fairly certain the developer in question does not understand / care what big-O notation means. Therefore, this almost certainly is not the thought process that lead to the slow load times in GTA. More likely the developer was just mashing things together until "it works".

Re: Competitive programming is useless

#123
post #120

Earlier quoted context omitted.

> Almost everything you will ever need is already implemented in a library for you to reuse, and even reaching for that library is pretty rare. Developers who have no interest towards algorithms will not even have the skills required to identify opportunities where algorithms should be used, much less the skills required to identify which algorithm should be used. For example, I had a conversation here on HN a few we…

> somebody said that they will not need to learn anything about sort algorithms, because they can just google bubble sort and copypaste it if they need sorting at work In this example, the missing skillset is not memorizing a book of algorithms as you seem to imply. If performance isn't good for the use case, they should be profiling the code for root causes. Which will lead them to identifying the sort operation as…

> In this example, the missing skillset is not memorizing a book of algorithms as you seem to imply.

No it's not. As I said in the sibling comment, competitive programming (or algorithm skills in general) isn't about memorizing algorithms, it's about developing skills that allow you to understand and create algorithms to solve problems. In this case, it would be sufficient to understand why looking up a phone number in a phone book should inherently be a O(log n) operation, not a O(n) operation.

> I don't want to hire software engineers who have memorized the algorithm book, that's not useful to me. I want to hire those who can apply discipline to the work, such as (in this example) be aware of performance and know how to analyze it and find solutions.

So we're discussing a hypothetical developer who has "no interest towards algorithms", and you're imagining that this person is going to run a profiler to troubleshoot a performance issue and subsequently optimize algorithms to fix said performance issue? This sounds like a fantasy to me. If you want skilled software engineers who have the ability to troubleshoot and optimize algorithms, you probably need someone who has some kind of interest towards algorithms.

Re: Competitive programming is useless

#124
post #83
post #45

Earlier quoted context omitted.

you obviously have a pretty strong bias. I didn't say its a requirement, I said they would have a higher percentage of gifted students. Also the requirements are not "above average", a math SAT of 750 is in the 95% percentile of SAT takers, which is already below average for MIT. Even then, the "average" student isn't even taking a college readiness test. You are grossly overestimating what average is.

Can you clarify how this can't be prepped for, and is a marker of intelligence instead of also being explained by average intelligence, coupled with means ($$) and drive? I attended a top school. I can assure you my classmates weren't on the whole more intelligent. They did have more drive, better study habits, more external forces (parents) pushing them. Some were extraordinary, but not the average. I would have tro…

Here[1] is a good overview of studies on test prepping and their relatively underwhelming influence on scores:

>Once scholars control for all these factors as best they can, they find that coaching has a positive but small effect: Perhaps 10 or 20 points in total on the SAT, mostly on the math section, according to careful work by Derek Briggs of the University of Colorado Boulder and Ben Domingue of Stanford University.

[1] https://slate.com/technology/2019/04/sat-prep-courses-do-the...

Re: Competitive programming is useless

#125

Earlier quoted context omitted.

Isn't this basically what competitive programming is? Maybe I'm a bit clueless, but my assumption was most people have standard libraries of common algorithms/implementations they pull from and tweak/glue as needed to fit the problem in front of them. Those libraries are not standardized, but there is for sure basically a common set of things you need to be competitive, right?

There is a common set of algorithms that most people who do well in such a contest can implement whenever they like, but most of the effort involved in solving the problems happens before they write any code, and many (half or more?) problems can't be solved by just applying the techniques from this repertoire.

This is correct. A typical CodeForces problem is intentionally constructed as a unique snowflake that can't be solved by just calling a library function. You need to be able to design an algorithm that solves that specific unique snowflake on the spot. Perhaps your algorithm also makes some library calls to other algorithms in your comp.coding library, but those are merely building blocks for your own thing, which you have to invent.

Re: Competitive programming is useless

#126

I like the coding challenges we have at the office. The ones who want come to solve a few riddles (this is a nation-wide competition), food and drinks are provided, we have the opportunity to chat a bit and I can claim my last place, live every year. This allows people who like these kind of things to get together in a relaxed environment.

So you use coding challenges as a form of social get together?

Re: Competitive programming is useless

#127
post #120

Earlier quoted context omitted.

> somebody said that they will not need to learn anything about sort algorithms, because they can just google bubble sort and copypaste it if they need sorting at work In this example, the missing skillset is not memorizing a book of algorithms as you seem to imply. If performance isn't good for the use case, they should be profiling the code for root causes. Which will lead them to identifying the sort operation as…

> In this example, the missing skillset is not memorizing a book of algorithms as you seem to imply. No it's not. As I said in the sibling comment, competitive programming (or algorithm skills in general) isn't about memorizing algorithms, it's about developing skills that allow you to understand and create algorithms to solve problems. In this case, it would be sufficient to understand why looking up a phone number…

> So we're discussing a hypothetical developer who has "no interest towards algorithms", and you're imagining that this person is going to run a profiler to troubleshoot a performance issue and subsequently optimize algorithms to fix said performance issue? This sounds like a fantasy to me.

Our experiences are vastly different then. Nothing fantasy or hypothetical about this. Every great software engineer I've worked with is like this.

Profiling and identifying hot spots is an every-week occurrence in the field, very pragmatic and valuable work. Theoretical algorithms only happen on interview whiteboards, not on the job.

Re: Competitive programming is useless

#128
post #127

Earlier quoted context omitted.

> In this example, the missing skillset is not memorizing a book of algorithms as you seem to imply. No it's not. As I said in the sibling comment, competitive programming (or algorithm skills in general) isn't about memorizing algorithms, it's about developing skills that allow you to understand and create algorithms to solve problems. In this case, it would be sufficient to understand why looking up a phone number…

> So we're discussing a hypothetical developer who has "no interest towards algorithms", and you're imagining that this person is going to run a profiler to troubleshoot a performance issue and subsequently optimize algorithms to fix said performance issue? This sounds like a fantasy to me. Our experiences are vastly different then. Nothing fantasy or hypothetical about this. Every great software engineer I've worked…

You're arguing that someone who doesn't care to learn anything about algorithms is going to do a good job at optimizing algorithms.

Re: Competitive programming is useless

#129

I'd disagree with this assessment. In my own experience, I've found that competitive programming is useful in teaching a few skills. However, the apparent point of competitive programming--building up a good repertoire of advanced algorithms and data structures--is pretty close to useless. In my professional career, the most complex algorithm I've ever had to code myself is ... union-find (on like two occasions), wit…

To me competitive programming doesn't make you a good software engineer. It will teach you bad practices, like abusing of dangerous programming constructs or data structures to optimized the code or just save some typing while writing the code (like one letter variable names, macros, etc), global variables and state in the program, not using common design patterns, not using OOP, not documenting the code and in gener…

> It will teach you bad practices, like abusing of dangerous programming constructs or data structures to optimized the code or just save some typing while writing the code (like one letter variable names, macros, etc), global variables and state in the program, not using common design patterns, not using OOP, not documenting the code and in general writing code that is difficult to maintain because it's not well engineered.

These are not “bad practices”. Many of them are bad in certain common contexts, but literally none of them are bad in throw-away code used in the course of root-cause-analysis of problems in other code basis, and most are useful in many parts of proof of concept code. In working on production systems, most of the volume of code I produce isn’t production code, and has a very different set of constraints than production code.

And given history on HN, whether “not using OOP” is ever a “bad practice” is probably a whole discussion of its own.

Re: Competitive programming is useless

#130
post #82

Earlier quoted context omitted.

I have seen successful competitors people do basically that. And I have seen them train how to write basic algorithms super fast again and again. Yes, they had also algorithmic problem solving skills. But they learned huge amount of algorithms and datastructures so that they don't have to derive them each time. And they spend time literally training how to write them fast without mistake. It was not just about proble…

Ok. I'll take your anecdote at face value and shift my views slightly in that direction. I'll also note that even if some competitors do memorize algorithms & train how to write them fast without mistakes, this memorization perhaps gives them a slight edge, but it's not the core skill that separates winners from losers. A small edge, perhaps.

Necessary edge. There was tons of preparation specifically for competitions.

Not sure why would that be surprising. Same thing happen in chess, scrabble, anything competitive. Once there is enough competition, you can't go in with hope and talent alone. You have to train specifically for competition format.

Chess players don't base their play on pure problem solving either. They memorize and train specific plays.

Post reply on HN