DEV Community

Cover image for "Programs are meant to be read by humans and for computers to execute,  right?"

Posted on


"Programs are meant to be read by humans and for computers to execute, right?"

So I am on codewars (a coding practice site for programmers) solving coding challenges for fun and then I come across a question that is a little bit harder than usual ๐Ÿคจ.

I tried multiple solutions, ate some snacks ๐Ÿฟ, had a bathroom break ๐Ÿšฝ (which played a significant role in solving the question later), read some blogs ๐Ÿ’ป, googled (totally normal ๐Ÿ˜…), but the tests were still failing ๐Ÿ˜ฌ.

Eventually, maybe 30 mins later, I finally solved the problem ๐Ÿ’ช. I submitted my answer which was around 10 lines (lines don't matter but still). Then, I saw the best answer from the community that solved the problem in just one line ๐Ÿ‘€. ONE LINE ๐Ÿ˜ณ. With pure math ๐Ÿงฎ. I was mind-blown ๐Ÿคฏ.

Even though it was a correct answer and had many upvotes, many people (me included) have pointed it out that it was hard to read and understand for mainstream developers. For me, this is normal. I don't feel bad about my skills in cases like this, however, for beginners it might be a little upsetting that they couldn't come up with such solutions. To those who are feeling like that, I would say, don't feel frustrated. This is totally normal. One line or 10 lines, it does not matter. What matters is that the code you wrote works, readable and understandable. This is my opinion.

What is your take in this case? At the end of the day, programs are meant to be read by humans and only for computers to execute, right?

Anyway, to give you an idea how insane the answer was just read the comments ๐Ÿ˜…:

Comments from codewars community

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<