Skip to content

Instantly share code, notes, and snippets.

@rudrathegreat
Created August 28, 2019 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudrathegreat/a77dee47cc7a4285d063e0ab4aac03e9 to your computer and use it in GitHub Desktop.
Save rudrathegreat/a77dee47cc7a4285d063e0ab4aac03e9 to your computer and use it in GitHub Desktop.
How to be a Better Programmer

10 Coding Mistakes That Make Your Code Smell

hussein cheayto

Replicated on Github by me!

1. Redundant Comments

Don't add comments where they are not suppoed to be. For e.g. -

for i in range(x): # This is a for loop

2. Poorly Written Comment

Make your comment mean something, and be consise. For e.g. -

plt.show(p) # When used, it will show the window on your desktop

The example above is wordy. Instead it should be -

plt.show(p) # Display Window

3. Commented Out Code

If you have hundreds of lines of commented code, then it is helpful to remove those lines of code as they have no effect on the end result of the program. If somebody would like to see the code you used in your previous release, then they can see by viewing a backup.

4. Too Many Arguments

Too many arguments can lead to make your program stink. Don't make your functions have too many functions in them.

5. Dead Function

If a function is not being used in your program, then you should delete it. Similar to commented out code, clearing that up can help you debug code.

6. Functions and Variable Names

Try to make the names of your variables and functions actually tell what its job is to do.

print('Thanks for Reading!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment