Crafting Beautiful and Quality Code

By Nithesh | hashrouter | 23 May 2020

Do not repeat yourself — Repeat judiciously

I was used to follow DRY — Do not Repeat Yourself — religiously when writing the code, but later I realized that it is much better to repeat yourself in some scenario than sticking with DRY. It should be always a judicious decision based on the complexity and readability of the code. I think it is unnecessary and complex sometimes to add a common class and avoid the repeating code just to achieve the principle.

Keep It simple and Short — Yes, always please.

I am a huge fan of this, it is always good to make your code simple which can be readable to anyone. A good piece of code should be self explainable without comments.

Also name a function or class in such a way that one who read it should understand what task it is going to perform. And make sure to write tiny functions which exactly do what its name says.

Name it nicely

I have always used to spend time to think about the best name to choose for a variable , function or a class. While doing the peer review of the code I always suggest my team to follow this as well. Even though you are communicating with the machine with the code you should always make it readable to you peers who will be going to read it and understand what it is supposed to do.

How do you rate this article?



I am a full stack software developer.


My technical blog where i would like to share my developer stories

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.