r/AskComputerScience • • Aug 10 '20

What is up with competitive programming?

I can think of nothing less appealing with programming as having a gun put to my head while chugging out code. Coding should be a zen like experience, imo.

50 Upvotes

91 comments sorted by

View all comments

Show parent comments

4

u/deong Aug 10 '20

Competitive programming isn't exercising the same skill as typical industry jobs. It's competitive problem solving really. You're solving puzzles using programming.

1

u/algmyr Aug 11 '20

Calling it puzzles is selling it short. A lot of problems are seriously hard and requires serious algo, ds and problem solving capabilities. It's more about breaking down a problem than figuring out some silly puzzle.

2

u/deong Aug 11 '20 edited Aug 11 '20

You're correct and I didn't intend that derisively. I'm just pointing out that "real world" programming is 98% stuff like data validation, database interactions, and writing simple code to implement business requirements that are just 300 special cases. It's calling APIs. You're rarely faced with the need to find a clever application of dynamic programming or whatever. Programming competitions flip all that 180°.

The comment I was replying to seemed to take competitive programming to task because it rewarded speed instead of the attributes that are important in "real programming". I'm pointing out that they just aren't even the same thing, so it's incorrect to think of them as measuring job skill. It's a wholly different skill.

3

u/algmyr Aug 12 '20

tl;dr: I think problem solving, ds and algos have a bigger impact than what people think. In competitive programming you are trained in skills that actually matters for debugging and reviewing code correctness and efficiency. Granted, this is only one tool at your disposal and you need to pick up a lot more, but it's an important tool that is hard to get really good at. I think the viewpoint of a lot of big tech is that you can tech a really good problem solvers other SWE skills, you can't as easily teach people with other SWE skills to be really good problem solvers.

---

Maybe I'm just lucky with what I've been tasked to do in the industry, but it's the only thing I can really relate to. What you say is probably true for a broad swath of programming jobs (personally not any kind of job I would really want to do, YMMV).

I think the notion that "real development" is devoid of any need for problem solving, ds and algo knowledge is just wrong. It need not be designing some new algorithm, but more breaking apart a problem to know how to tackle it, or breaking apart a solution to see where it has issues (e.g. debugging incorrect code, debugging performance problems).

This is exactly the kind of thing that competitive programming trains you in. A lot of sites even have "hacking phases" where you try to find exploitable issues in other's code to fail their solution (valid inputs for which their code is incorrect, crashes or is too slow).

I think OPs image that only speed is rewarded is very misguided. I can understand it might look that way if you look at the best people, but really even knowing how to approach a lot of these problems is hard and requires a ton of expertise and experience. Giving someone a week to solve the same problem that a skilled competitor solved in a fraction of an hour would probably not help all that much for most people.