DEV Community

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

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)