This article brings to you amazing 5 programming habits that will change the way you code forever as a beginner.
1. Make your code as readable as a book.
- Use long, descriptive names
- Divide the code into logical subroutines
- Keep it simple when possible – there are no points for complicated one liner solutions
2. Follow three steps in this order:
- First make it work
- Then make it right
- Then make it fast and beautiful
3. Spend a lot of time reading and understanding a complex piece of code you might be interacting with
- Jumping to code when you do not understand what’s happening around will almost always result in an inefficient solution
- You’ll end up saving time
4. Use debuggers extensively.
- Understand input fast: put a break point, play around with methods on your input
- Sandbox: Quickly implement a solution in the watch/console section instead of rerunning the whole program
- Debug: Understand the state of the program and fix it up
5. Write tests, a lot.
- It’s better to fail early and fix the problem than fail in production.
- Every time you refactor, change, or add to your code, your tests will make sure you did not regress.
CONCLUSION:
That’s all for this thread. If you find this useful, drop a comment below to motivate us write more on similar content.
If you are new to the website, check us frequently for more useful tips.