Are you one of newbie programmer who starts but fell to step ahead, or feeling lots of pain in programming? Here I got 9 tips for you to make your coding life alive and enjoyable.
“You know what you are going to do magic. You are going to make this bloody lifeless mindless computer to do whatever you wish to. “
Amazing line isn’t it?
Well, there are lots of hindrances that will defiantly stop you many times during your coding. So let me tell you all one by one. I am sure many of the tips you’ll opt and make your life easier.
1. Text Editor you are using.
Pretty silly for newbie, but do you know this is one single factor that can make your 30-50% work easier and smarter. Is you are using Notepad for your text editor, please never use that. Most of your fuel will be waste in searching which line you are working, are you spelling the tags or other syntax correct?
Don’t waste time, just download Notepad++ now.
You won’t believe all you need to do install it, and before you start coding, go to Language Menu and select your language. There you go, see how everything goes right.
2. Indent your code whenever possible
May seems useless, but another mistake that give lot of pain to programmer. It’s really painful to find the proper section, sub section and sub sub-section in your code.
Look at this wired line.
How creepy it looks where to look for what code.
Now I am going to show you this line with some indent it.
See how beautiful and easy to understand code looks, easily you can find the bug, error and all.
We recommend you to use [TAB] key every time to indent the sub part of code to easily pick the line anytime quickly.
3. Closing/opening of Tags and braces
Another big mistake that most of the programmer do, whenever they start a braces or section for coding or opens the tag, at the end of big coding inside that, they mostly get confuse or forget the close the tag or braces. So at the time of compilation, Compiler get completely wrong code and produce lots of error.
So whenever you start s braces, put the closing braces at the same time, like printf() now go inside the both braces and start further coding inside the braces.
Similarly with tags, when you open a tag in markup languages, write the closing tag at the same time and get back one word and do whole of coding inside that.
Now put your curser in-between both tags give space or hit enters and start typing your further code.
Believe me you will never going to get any error due to wrong placement or missing or braces.
4. Don’t go ahead without algorithm
Algorithm are basically line by line procedure or say pseudo code for your entire program, this is not dependent on language. You can say algorithm as planning of your programme, how it will take the input, how it will process the input, which step it will repeat and how much time, what finally it going to return all.
A best and efficient program is all due to best algorithm. Make sure you have best algorithm or plan before you write the code.
- Take the pen and paper,
- Outline your programme
- Break everything in step.
- Re-use the steps if possible.
- Think alternate steps too,
- Divide big problem into small parts and prepare pseudo code for all individually.
5. Think of output while designing
You should not go ahead in dark without complete planning and algorithm, while you think of algorithm, always have vision for your output, how it going to look, how it will going to react at different user input and be broader as much as you can and see how much your programme will gain and how stable it going to be.
6. Compiler version
Many compiler or interpreter get update time to time and get more stable from bugs and error as per new release. If you are sticking with older version of browser/compiler or editor, you might face unusual error time to time. So get the latest release and code and say hello to new world.
7. Utilize the comment section
Comment section mainly serves two things for programmer.
Firstly for a team, it tells everybody what special is happening in this line. That means a little info about the code or section of code.
Secondly, it deactivates the phrase or section of code so that computer doesn’t process it for output. Only human can see it.
Its Pretty good to give comment to special or important section of your code. In another case, if you don’t need a particular section in program, don’t erase that, comment that section or make that section inside comment by applying /* before and */ after the code. Whenever you need that again, just remove /* */ and done.
8. Use Modular programming
Until you are kid, no programme needs a single function, if you are dealing with some practical problem, its best if you divide that in many functions and modules. You can code each module and link those all whenever you need. You’re programme will be more amazing and easy to understand and even perform.
9. Compile your programe first in your mind
Whenever you finished coding, before going ahead, see and double check each section of your programme first and make sure it works, when you are unable to find the bug after that compile/run the programme, you will get 30% better productivity.
I hope I covered all the basic pain causing stuff for you guys, share with your friends and be a good and responsible team and friends. Have happy programming. See you guys..