DEV Community

Discussion on: HackerRank Is Teaching You to Write Terrible Code

Collapse
 
brunooliveira profile image
Bruno Oliveira

As a former competitive programmer, I can't completely agree with the premise of the article for a simple reason:
Hackerrank and similar websites are NOT teaching you code.

The purpose of those websites is to test for and practice algorithms and algorithmic thinking and, last time I checked, the code editor there allows you to delete everything entirely and write your own.
Their premise is that if the core of the problem is to test your knowledge of say... Dijkstra, the way you'll parse your input files and read input and write output are a distraction with respect to knowing whether you can or not write a Dijkstra based solution.
Some websites choose to let you upload your code entirely or others give you these placeholders. I'd dare say that competitive programmers would be smart enough to never take that code as production-ready at face value.
Also as a sidenote, I never, ever needed to read/parse files in a professional setting in any non-trivial way besides reading the file as a list of lines.

Collapse
 
raddevon profile image
Devon Campbell • Edited

Here's the problem with that: junior developers are using HackerRank to practice because they're being sent there by recruiters and companies to complete coding problems as part of job interviews. If that's the site that gets them the job, it seems natural to practice there as well.

It's easy for you and I to look at this with a more robust perspective and say, "Well, of course this isn't the code you're supposed to write in production," but that's not made clear to a new developer. They don't have the tools yet to be critical of the efficacy of this code in other contexts. Competitive coders will have those tools, but HackerRank does nothing to keep out those who are not competitive coders and it doesn't make it clear that the platform is only intended for them or even just that the code is not production-quality.

If I were inexperienced, interviewing for a job and they sent me to test for the job on HackerRank, I would assume the code used on HackerRank reflects the code they will want me to write on the job. Why would they want to test whether or not I can write code they won't accept from me if I'm an employee?

So, HackerRank may not claim to teach people to code, but they are teaching people to code, for better or for worse (in my opinion, for worse).

Thanks for reading and sharing your perspective, Bruno.

Collapse
 
wojtekidd profile image
Wojtek Cichoń

Thank you for this post. I'm 3 months into a Python Bootcamp and started doing a basic Python path there. The code they suggest in their basic arithmetic tasks is really weird and questions all I've learned so far. It's good to hear that I'm not the only confused person around.

Collapse
 
brunooliveira profile image
Bruno Oliveira

Wow, thank you so much for your reply! :) (I assume you're also far more experienced than me, so this is a great perspective)
I agree with what you say indeed, junior devs or people just "going at it for the job", even if they're good at algorithms, can definitely pick up very bad habits from that scaffolding code that lies there.
Unfortunately competitive programming is literally a competition so writing unsafe, sluggish but blazingly fast I/O routines and taking some dubious shortcuts it's the norm there (top competitors using C/C++ would have hundreds of lines amongst macros and custom I/O routines just to shave off ms on reading and processing input) and unfortunately some junior devs can definitely approach those platforms completely misguided and start their career with the left foot there... Ultimately experience and long exposure to production code will fix all of these quirks but I agree it's a big problem with more and more companies "outsourcing" code challenges on these platforms nowadays. Thanks a lot for your reply