• Skip to main content
  • Skip to primary sidebar
BMA

BeMyAficionado

Inspire Affection

What is a Coder’s Worst Nightmare?

August 27, 2017 by varunshrivastava Leave a Comment

Hey Young Programmers!

Today’s GYAAN is all about writing CLEAN CODE.

It’s been quite a long time when I wrote my first bit of code, and from there till now, lots of things have changed.

I remember it quite vividly, how I used to write code back then when I started coding. I was always good with logics and knew how to accomplish a task that was put in front of me.

It was all good and blissful in the beginning when I only use to play with logics. But later when I dived into the real world, things were not the way it used to be.

Real world programming is a totally new paradigm. People will cherish you not because you can write logics quickly but how easy can you make it for others to understand it.

I would like to quote Woody Guthrie quote here-

[bctt tweet=”Any fool can make something complicated. It takes a Genius to make it Simple.” username=”vs_shrivastava”]

Never become someone’s nightmare, become someone’s acquaintance.

So, just to transfer my knowledge so that you guys can pick those things earlier in your career, I decided to write a blog on it.

Please comment below your tips, views and ways you follow to ensure clean code.

Table of Contents

  • #1 Proper Indentation
  • #2 Proper Naming Conventions Must be Followed
      • And I must tell you, I have seen the worst…
      • I have also seen the best naming conventions.
  • #3 Comments where Necessary
    • What do I Think?
    • Additional Tips

#1 Proper Indentation

Proper Indentation make your code readable

This is the most basic.

You code should not scare the crap out of the programmer seeing it for the first time.

Infact, your code should not look like a code at all, it should look like a beautifully crafted piece of art. Or what I like to put it-

[bctt tweet=”Make Your Code Kissable” username=”vs_shrivastava”]

Your code should always flow like a poetry and person looking at your code should bless you.

He should not have any readability issues and it all should look systematic.

Now-a-days IDE (Integrated Development Environments) are there to make your job easy but then too, don’t rely on it completely. Make it your habit today.

#2 Proper Naming Conventions Must be Followed

In computer programming, a naming convention is a set of rules for choosing the name for your identifiers which denote variables, types, functions, and other entities in source code and documentation.

This is the most important aspect of a coders life. No IDE, no matter how advance, can help you in correcting the names for identifiers to make it more understandable.

Currently, I have been working as a programmer. Sometimes, I have to dig down into codes written by multiple developers.

And I must tell you, I have seen the worst…

At some point, it feels like punching the developer on the face. The work which should have taken only about 30 minutes extends the whole day.

The cost of labour increase by many folds because instead of writing sum developer have chosen to write s and instead of writing mul it is m.

After reaching a certain point, you literally pull your hairs out of your scalp. So, please don’t use a,b,c to name variables. Use complete word or combination of words to make it readable and understandable.

I have also seen the best naming conventions.

Even if the logic is hard and complex, a good naming convention can make it pretty easy to understand.

It reduces the overall digging time and helps the analyst to search for the actual problem without having to deal with the stink of that code.

Following are the Reasons to use proper Naming Conventions:

  • reduce the effort needed to read and understand source code;
  • enable code reviews to focus more on the important aspects than arguing over syntax and naming standards.
  • enable code quality review tools to focus their reporting mainly on significant issues other than syntax and style preferences.
  • enhance source code appearance (for example, by disallowing over-long names or unclear abbreviations).

Proper Naming Conventions makes your code understandable

Don’t simply use c, d, ex, etc… to name your variables and methods and classes and interface and whatever damn thing it is.

Because, only you can understand what those variables do. And after-a-while, even you cannot understand what they does.

Then there will be no one to understand what they does.

It has also become an industry standard and plays a major role in hiring a potential programmer. So, make sure you use proper naming conventions every-time you write code.

 

#3 Comments where Necessary

Comment makes understanding of the code easy

This is one of the few things that you learn at the beginning of any new language. It is because these things play a vital role in any organization in which there are more than 1 developer working on a project.

As we all know that comments are used to provide additional meaning to a function, variable, process which is not easily understandable.

Also, comments are for humans. So, write for a human as a human with humanity.

One thing you should always keep in mind while commenting – never overdo it.

It can interfere with the readability of your code.

It should help others to understand the overall logic without at the cost of code’s readability. That is why there is a proper way to write comments as well.

Every programmer might have different views related to the comments.

Some say that your code must be self-explanatory, some prefer comments to give them an overall picture of the function before they dive in. There is no definite rule for comments.

What do I Think?

I think, a comment is necessary but not always.

If the logic of the function is complex and there are a lot of things that a function do (which a function should not) then there is a need for a comment to provide an overall picture.

Another thing that I like is that a comment should come at the very beginning of any function or a block.

In-line comments must only be used when there is an appropriate need for it and must not interfere with the original code Proper spacing should be kept in mind.

That’s my experience, different programmers may have different views.

The above-mentioned ethics will help you in long run. It will also make sure you become a good programmer.

[bctt tweet=”The difference between an ordinary and extraordinary is the EXTRA that he does.” username=”vs_shrivastava”]

Follow these conventions and write kissable code (as I say)

Here’s a great story I found on Quora while surfing and that’s when the idea popped in to write this blog. This is a real nightmare for any programmer. Do read the whole story, there’s lot to learn in it…

Read?Mick Stute‘s?answer?to?What is a coder’s worst nightmare??on?Quora

If you have any question regarding any of the information mentioned above, just feel free to comment below and let me know. Or if you think I missed something that must have been mentioned, then just mention below, I will make sure to add it.

Additional Tips

  • always try to write a code which uses optimal resources but never make the code complex. try to keep your code as simple as possible so that the next programmer after you would be able to understand it.
  • Writing the code is not the hardest part, analysing the requirement is.
  • A code can be written in many ways but the output will always be as per requirement.

 

I hope this article has touched the main points of a clean code. Keep coming back, as I’ll keep updating this article with more such practices. And yes the main part, please do share, like and comment your view below.

Related

Filed Under: Programming Tagged With: coders worst nightmare, good naming conventions, proper comments, proper indentation

Primary Sidebar

Subscribe to Blog via Email

Do you enjoy the content? Feel free to leave your email with me to receive new content straight to your inbox. I'm an engineer, you can trust me :)

Join 874 other subscribers

Latest Podcasts

Recent Posts

  • Is The Cosmos a Vast Computation?
  • Building Semantic Search for E-commerce Using Product Embeddings and OpenSearch
  • Leader Election with ZooKeeper: Simplifying Distributed Systems Management
  • AWS Serverless Event Driven Data Ingestion from Multiple and Diverse Sources
  • A Step-by-Step Guide to Deploy a Static Website with CloudFront and S3 Using CDK Behind A Custom Domain

Recent Comments

  • Varun Shrivastava on Deploy Lambda Function and API Gateway With Terraform
  • Vaibhav Shrivastava on Deploy Lambda Function and API Gateway With Terraform
  • Varun Shrivastava on Should Girls Wear Short Clothes?
  • D on Should Girls Wear Short Clothes?
  • disqus_X5PikVsRAg on Basic Calculator Leetcode Problem Using Object-Oriented Programming In Java

Categories

  • Blogging
  • Cooking
  • Fashion
  • Finance & Money
  • Programming
  • Reviews
  • Software Quality Assurance
  • Technology
  • Travelling
  • Tutorials
  • Web Hosting
  • Wordpress N SEO

Archives

  • November 2024
  • September 2024
  • July 2024
  • April 2024
  • February 2024
  • November 2023
  • June 2023
  • May 2023
  • April 2023
  • August 2022
  • May 2022
  • April 2022
  • February 2022
  • January 2022
  • November 2021
  • September 2021
  • August 2021
  • June 2021
  • May 2021
  • April 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • February 2020
  • December 2019
  • November 2019
  • October 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016

Tags

Affordable Hosting (4) algorithms (4) amazon (3) aoc-2020 (7) believe in yourself (4) best (4) database (4) earn money blogging (5) education (4) elementary sorting algorithms (4) experience (3) fashion (4) finance (6) Financial Freedom (7) food (7) friends (3) goals (5) google (5) india (10) indian cuisine (5) indian education system (4) java (16) life (16) life changing (4) love (4) make money (3) microservices (9) motivation (4) oops (4) podcast (6) poor education system (4) principles of microservices (5) problem-solving (7) programmer (5) programming (28) python (5) reality (3) seo (6) spring (3) success (10) success factor (4) technology (4) top 5 (7) typescript (3) wordpress (7)

Copyright © 2025 · Be My Aficionado · WordPress · Log in

Go to mobile version