DEV Community

Cover image for What is a Good Code?

What is a Good Code?

anshumanmahato profile image Anshuman Mahato Updated on ・2 min read

When I started with programming, to me, it was all about getting the job done. I was clueless about things like readability, scalability, commenting and all. Adding to this, I strongly believed in this idea - "If it works, don't touch it."

If it works, don't touch it

This ignorance was so evident in my code that anyone who would have read that could have told that either I don't know about it or I don't care, both are signs of a naive programmer. Because of this, I always found myself in situations where even I couldn't understand my code.

The only god understands my code meme

Well, it was all until one day when I came across this meme.

Code Review meme

I got curious about this code review thing and did some google. That's when I came to know about things like code quality, efficiency, data structures and other necessary elements of a Good Code.

So, what exactly does it take for a snippet to be a Good Code? From what I understood, in a broad context, it should meet the following criteria.

  1. It should be readable.
  2. It should be scalable.

What does it mean for a code to be readable?

By saying that the "code should be readable", what I mean is that is should be understandable. Not just to the computer or you. But also to people who are working on your code and who will manage your code in future. It should have a consistent coding style.

Psychopath manages your code meme

What does it mean for a code to be scalable?

By saying that the code should be scalable, what I mean is that the code should perform at par with the load. It should be able to manage user requests efficiently and accurately. It should be able to compensate in case the load increases and should utilize the hardware. In a broad context, it should be adaptable to change. Higher the adaptability, the more is the scalability.

Writing good code

What do you guys think makes a Good Code? Share your views in the comments. And if you liked this post or found this post meaningful, do hit ❤ .

See you next time. Until then, keep learning, keep hustling.

Discussion (0)

Forem Open with the Forem app