What are the best practices and habits to become a hardcore programmer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are the best practices and habits to become a hardcore programmer?

As far as logic and basic language goes we can learn and improve here at sololearn. but real world development requires advance skills and practices. what should we do to improve and accelerate learning.

2nd Jun 2017, 11:22 PM
Riz
Riz - avatar
1 Answer
+ 3
Here's a few: * Comment diffucult to read code And, Comment what a function is supposed to do if it is not apparently obvies. * Use a naming convention Generally: camelCase on methods/variables CapsCase on classes ALL_CAPS on constants Which brings me to, * Use names that make sense int a, b, c, d...; nobody wants to find out what all that garbage means. I'd say the only exception to this may be the incrementing variable of a for loop. Usually people just use i, or k for that. * Avoid any redundancies I see these in SoloLearners codes all the time, here's an example: if(boolean == true) A boolean is a condition, comparing it is redundant. Just do: if(boolean) * Indent or space code appropriately Don't make things harder to read than they should be. * Always try to keep variables in the smallest scope possible That means, don't use things like a global scanner if you're just using it in one function. * Use appropriate loops. Do I need a for, while, or do-while? Yes you can sometimes use them all for certain situations, but they're different for a reason. * In a for loop, don't modify the incrementing variable inside the loop This is insanity to read. According to my professor, all pro programmers follow this rule. * Stick to keeping everything private. This is fantastic practice, never use public or protected until you know you'll need it.
3rd Jun 2017, 1:13 AM
Rrestoring faith
Rrestoring faith - avatar