Competitive-coding sites are a thing. There are so very many — HackerRank, LeetCode, Codewars, CodeChef, CodeEval, and the mysteriously-named SPOJ, to name check but a handful among the bazillions. But what exactly is their value in the self-taught programmer’s learning curve?
The upshot being, if you’re interested in code challenges, there is almost certainly a site out there that will suit your particular parameters. The question is, though, is this a wise way to invest time and energy early in your coding career, when you maybe should be more worried about actually getting good at coding than you are about pwning fellow programmers?
The answer seems to be a resounding “Well, it depends.”
The obvious benefit to undertaking code challenges for a Code N00b is the same as a beginning musician practicing scales — you’re working on that muscle memory. Going over and over your basic repertoire of being given a problem, thinking through to the solution, attempting to render it in code, then debugging til it works — this is only a good thing, right?
Then there is the added benefit, at least for more advanced coders, that code-challenge sites are good practice for job interview situations where you’ll have programming problems tossed in front of you as part of the evaluation process. Indeed, some code-challenge sites have corporate-sponsored content — challenges that can help you get a job if you solve them well — because tech companies have recognized the talent recruiting value of sites that attract those of us driven to code competitively.
So, then, where is the downside?
“Don’t value cleverness over clarity.” — Gordon Zhu
I also really liked that, after you got your code to work, you could check out other Codewars user solutions to the same challenge. Doing a Codewars kata each day became one of the ways I kicked off the new year and participated in the 100 Days of Code challenge.
So, for me, it was good practice, and also I learned quite a bit along the way — not just picking up specific new tools or techniques, but also more globally important knowledge. Like the realization that you don’t actually need to know absolutely everything, and that googling for solutions when stuck is a solid skill in a developer’s toolbox. (! important: I don’t mean googling for the answers to the challenges, which is cheating and defeats the purpose you’re there in the first place. I’m talking about seeking out ways to solve a problem, or parts thereof, yourself.)
The best thing I got out of doing Codewars, though, was intangible but truly essential: I started thinking of myself as an actual coder. Before, I had just been somebody who was learning to code. But now? I could solve real-life programming problems, no hand-holding required.
Thus it came as a surprise to learn that the are more than a few folks — a couple of whom have been significant mentors for me — who think code challenge sites aren’t all that great. Or, even worse, that they can even be detrimental to a burgeoning dev’s progress.
I have been working through Gordon Zhu’s Watch and Code JS curriculum, and he is no fan of code-challenge sites. He even made a YouTube video to explain why he doesn’t want his students doing them at all, comparing code-challenge sites to trying to get better at life by watching television:
People new to programming, he said, hold the misconception that they can get better by doing code challenge websites which tend to offer “really unrealistic, useless, fill-in-the-blank kinds of questions.” Doing code challenges recreationally is ok, Zhu added, so long as you understand it’s just for fun, and not a learning path — just the way that watching Jeopardy is fun and you even learn interesting facts, but it’s not a substitute for actually studying, say, history.
“It’s not the most useful thing you can do,” Gordon told me. “It’s better to just read open source code.” (Cue sad trombone sound).
But, but, but…looking at, and learning from, other people’s solutions, comparing how they went about tackling the challenge compared to how I did it? I made this argument to some other, more experienced programmers, explaining how seeing more elegantly rendered code taught me to write better, DRY-er code myself. The answer was a universal, “Yeah, but…” rebuttal about how the culture of many code challenge sites values cleverness and brevity above all else — which are not actually always that valuable in real life work.
Or, as Zhu told me, “Writing short and tricky code is cool as an idea, but every time your coworkers have to read that they just want to kill you. Don’t value cleverness over clarity. It would be like if you wrote your documentation as a rap, and everyone who needs to refer to it ends up wanting to punch you in the face. Don’t be that person.”
Yikes. I have to admit, it did take some of the Codewars wind out of my sails to realize that people I look up to personally and professionally don’t think it’s the best use of brain cells. I don’t think this is the reason I no longer attempt a kata a day, but I do believe that code challenges can be one of the tools we use. Being presented with different types of puzzles and problems helps you become a better problem solver, teaches you to stick with it and work for a solution. You get more practiced in your chosen programming language, maybe learn new algorithms or other useful skillz (a Codewars challenge I was particularly stuck on finally inspired me to get over my fear of tackling regex, for example).
My Codewars leaderboard progress has definitely slowed in recent months, but I didn’t stop doing daily code challenges because they’re somehow detrimental. I stopped because I’ve gotten to the point where I am putting a lot of that practice into action, building larger and more complex apps and projects. I feel like there is a lot more to be learned, and also feel like I’ll be back.
So, yeah, code challenges: I too have ended up in the “Well, it depends…” camp. Not the perfect path, but also not a complete waste of time. It does indeed depend on where you are, knowledge-wise, and where you want to get to. Sorry, that’s so vague.
But one thing I am now really, really sure about? I will not ever write up any of my documentation in the form of a rap.
Check out more of Michelle G’s Code N00b columns here.
Codewars/Question illustration by Michelle Gienow.