top of page
Search

Five tips on how to write Better Code.

Updated: Dec 11, 2020

Writing good functioning code is the pride of a programmer. So, here are ten ways to write better code:

1) Keep the code you write simple: Make sure that the code you are working on is expressed in a simple manner. Don't hesitate to write a few extra lines of code if you can make your code simpler.


2) Don't try to memorize every line of code you will ever use: Never try to memorize the code you will need to write. Instead, search your query on the internet. This way you will get many solutions to the problem that is troubling you. Browsers like Google Chrome and websites like Stack Overflow and Geeks for Geeks will become your best friends in programming.


3)Choose and IDE your comfortable with: An IDE is an integrated development environment. Basically, it is a special place to write your code. There are thousands of IDE's out there and it is good to choose one you like. Doing this will help you to write better code as you will be more comfortable with the environment. Some great IDE's are Pycharm, Spyder, Sublime Text, Atom, IDLE, QT Console and Jupyter Notebook.


4)Keep the code you write clean: Make sure your code is clean. Leave a few lines between sections of your code. Also always remember to indent your code. This helps to solve the problem of cluttering. Also, if an error occurs in your code you can quickly find out where and why the error occurred.


5)Use comments in a systematic and smart way: Comments help organize code. They can help you when the program you are working on is long. This way you can diagnose and fix errors quickly. Don't use too many comments as this can lead to confusion. Thanks for reading!


 
 
 

Comments


bottom of page