• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Subscribe BMA
  • Contact Us!

Be My Aficionado

Inspire Affection

You are here: Home / Programming / What is a Coder’s Worst Nightmare?

What is a Coder’s Worst Nightmare?6 min read

August 27, 2017 by Varun Shrivastava 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.

Topics Covered

  • #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.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • More
  • Click to print (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Skype (Opens in new window)
  • Click to email this to a friend (Opens in new window)

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

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Featured Posts

Big Query: Everything You Need to Jump Start Your Development

July 23, 2018 By Varun Shrivastava Leave a Comment

Spring Web MVC (3.x) Configuration From Scratch (Using XML)

November 8, 2019 By Varun Shrivastava Leave a Comment

Easy to Cook Tiffin Dishes for Working People

October 15, 2016 By Priyanka Yadav Leave a Comment

Festive Delights with Palak Chat and Mung Rolls

August 23, 2016 By Priyanka Yadav 2 Comments

Work Smarter: 5 Tips to Use Your Time Better

March 25, 2017 By Priyanka Yadav 2 Comments

Latest Posts

  • Study Abroad Destinations : Research and Review
  • Advent Of Code 2020 – Day 7 – Handy Haversacks
  • Advent Of Code 2020 – Day 6 – Custom Customs
  • Advent Of Code 2020 – Day 5 – Binary Boarding
  • Advent Of Code 2020 – Day 4 – Passport Processing

Categories

  • Blogging (101)
  • Cooking (11)
  • Fashion (7)
  • Finance & Money (12)
  • Programming (50)
  • Reviews (2)
  • Technology (22)
  • Travelling (4)
  • Tutorials (12)
  • Web Hosting (8)
  • Wordpress N SEO (19)

Follow us on facebook

Follow us on facebook

Grab the Deal Now!

Hostgator Starting @$3.95/mo

DigitalOcean Free Credits

Trending

Affordable Hosting amazon aoc-2020 bad luck believe in yourself best database earn money blogging education experience fashion finance Financial Freedom food friends goals google india indian cuisine indian education system java javascript life life changing love make money microservices motivation oops poor education system principles of microservices problem-solving programmer programming reality search engines seo SSD Hosting success technology tips top 5 web web developer wordpress

Copyright © 2021 · BeMyAficionado by Varun Shrivastava · WordPress

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.