views:

1020

answers:

12

I am looking to hone my programming skills outside of school/work and was wondering if any of you have participated in competitive arenas like CoreWar or TopCoder strictly for the purpose of self-improvement. If so, have you found them to be worthwhile and are there any other similar 'games' out there which merit mentioning?

+3  A: 

They're fun exercises, and to some extent test one's abilities, but I've not found them to be useful for improvement in general. If anything, timed competitive events tend to teach bad habits.

moonshadow
+4  A: 

I would say not so much for the speed aspect of the competition...but going through the old contests and working through the solutions are good. The more code you write, the better you become.

Mike Brown
+14  A: 

I learned several things from TopCoder competitions:

  • You can never be too paranoid when writing code. Writing code that works with the expected inputs = easy. Writing code that works for every possible input = harder. It changed my mind set from: How can I make this work to how can someone make this not work.
  • I guess because I didn't go to lectures in school I also learned quite a few tricks from TopCoder, like for instance memoization.
  • I used to be over confident. Believed I was a pretty good coder. Often didn't even compile the code prior to committing. After TopCoder I think I'm average. Some of the coders on TopCoder are amazingly good.
Bjorn Reppen
+8  A: 

Competitive programming really changed my life, but that might just be me. I started out with the ACM ICPC, which requires you to work with a team of two other programmers. This was my first chance to program with people that actually knew how to program, and it taught me a lot about how to solve problems with others in highly demanding situations. Later I took on more of a coaching role, which, like teaching, will greatly expand your mastery of the art.

There was also a financial benefit for me. When TopCoder started out, it was a pretty lucrative opportunity. When you reach the point where you can quickly identitify and reduce a given problem to something you've already solved, you'll find you can ace any technical interview. Competitive programmers are targeted by recruiters from big companies, and the credentials always look good on resumes (or at least they do to me).

Logan
+1  A: 

Yeah, I have to agree. Doing it for the competition, probably problematic and will just teach bad code habits.

Doing the "competitions" after the fact to learn, perfectly fine.

Dre
+5  A: 

I’ve done the ACM ICPC contest and found it very helpful, for both the huge amount I learned about algorithms, and for my career—“___th in the world” is a good hook for a résumé.

You will learn a lot and get a great deal of experience practicing, and you’ll have a wonderful feeling of accomplishment from having done a really good job on something really hard, but it’s important to keep in mind all the very important things about programming that aren’t relevant in programming contests—documentation, maintainability, portability, fault-tolerance, ambiguous requirements, exponential increases in complexity as the number of components increase, resource allocation in large organizations…

If I were to do it again, I would definitely approach it differently. Don’t just do the easy TopCoder or UVA problems; pick a contest (e.g. one TopCoder Single Round Match), take all the problems from that contest, and hack away at it until you’ve solved at least 3/4 of them. You want to be good at solving the easy problems quickly, but you also need to know how to solve the hard problems too, even if it takes weeks at first.

andrew
+3  A: 

Many mention bad habits as a result of competition, which I agree to also if one think programmers don't understand the differences.

But, I also think a few good things gets to be thought of in a competition.

  • What is enough? This is maybe a result of a clear goal - which is also important IRL
  • Don't overdesign
  • Learning the tools etc and gaining a deeper understanding

I saw a link to this competition here at SO that I think was pretty fun

epatel
+4  A: 

I went to many of the ACM competitions. These types of competitions can be good and bad. Going through the problem sets to completion can be good in that they teach you how to think more methodically and solve complex problems (which sometimes have easy solutions that are well hidden). This kind of thinking and practice are excellent.

However, the speed factor of the competition encourages bad practices which you wouldn't want to bring into a professional career. In a timed competition, you will want to take many shortcuts to come up with a correct answer in a speedy time.

Competitions enhance problem solving skills - not programming practice. I recommend going through old problem sets to enrich your thinking skills but study proper patterns and practices so balance our your design strategies.

j0rd4n
+1  A: 

Anecdote alert. I was part of a company team that went to the British Computer Society programming competition in the mid nineties. In this ompetition, you were given half a dozen programming problems, and you chose which ones to try and solve. For every incorrect solution you submitted, you were given a time penalty, but not why your submission was broken.

For one particular problem, many teams submitted solutions, are they were all judged incorrect. After many re-submissions, all failed, the organisers sheepishly admitted that their "correct" benchmark solution was in fact broken, and that could everyone please resubmit their last solutions.

Half of the teams walked out.

skaffman
+5  A: 

I find that they're an excellent way to teach yourself what you don't know. There are two facets to this: the stuff that you genuinely don't know, and the stuff that you think you do but fail to deliver on when needed.

In the first case, I was doing pretty well in the Google CodeJam competition until I had to drop out as the round coincided with a wedding, and it's frowned upon to be compiling during the "I do"s :) But I went back and looked at the problem set later for the round I missed, and realised I wouldn't have done very well because I really didn't know how to attack one of the problems. After some reading around, and looking at some discussion threads, it turns out I would have needed to perhaps use linear programming to solve an optimisation question. Although I knew of its existence, I certainly didn't know enough about LP to make use of it. Now I do. That's the benefit of these programs.

The instances of the second case are too many and too painful to enumerate. Think you understand dynamic programming? Here's where you get to find out definitively. It can be a problem if you're not humble enough to admit to your shortcomings, but if you are you stand to learn an awful lot.

These comments apply equally to doing the problems competitively or after the fact.

HenryR
A: 

I haven't done the competitions yet but have been working on problems from the uVA and SPOJ sites and have already learned a number lessons that I think will be helpful in the future.

unclerojelio
+1  A: 

I have done a lot of Marathon Match competitions at TopCoder. Marathon Match competitions usually last one or two weeks and the problem cannot be solved perfectly. You can check my profile here : tpelkone

I have to say that during two years of competing, I have learned a lot. My initial plan was not to make money by competing, instead use my free time on interesting problems and learn about algorithms; those kind of things that you might not be able to do at work.

Programming competitions might teach bad habits, if you do not already have good habits. I don't think I have learned any bad habits, because I have sticked with "proper" way of writing code. It also helps that competitions I have participated in do not have insane time limits.

Other interesting competitions are arranged ICFP, but they arrange competitions only once a year.

Tuomas Pelkonen