What is the best advise for someone new to programming?

By this, I don't mean 'Buy this book' or take a class on this website etc. I mean specific advise that you either gave or received about the basics of programming?

The best advise I ever received was that 'Print statements are your friend. Build your structure first and verify as you go by using print statements. Then worry about the meat of the program.'. ie.

1
2
3
4
5
6
7
8
9
10
11
int intX = 10

if(intX > 10)
{
   cout << "pass";

}
else
{
   cout << "fail";
}
Last edited on
The best advise I ever received was that 'Print statements are your friend. Build your structure first and verify as you go by using print statements. Then worry about the meat of the program.'. ie.


Better advice would be to learn to use and love your debugger. No need to change your code (usually) and you can do a lot more in it that just print statements.
Don't use debugger. Don't use break statements. Use character arrays instead of strings for some time in the beginning . They help developing your logic.
Don't fix your car, rebuild it from scratch. It helps with your understanding of cars.
I always went by, "Don't overwhelm myself" Usually if I tried to learn too many complex programming skills at once I would get a headache, tear some hair out, and just bang my head on the keyboard. If I ever start to get annoyed at consistent errors, I just minimize the IDE, open Chrome, and just surf the boring internet for a couple minutes.
+1 @ firedraco

Learning to use a debugger should be like the very first thing you learn. Being able to step through a program line by line and being able to see the contents of ALL variables as the program progresses gives you a clear and complete view of what is actually going on in your program.

Littering your code with print statements is like a half-assed way to do the same thing a debugger already does... only it doesn't do it nearly as well (and then you're left with a million print statements in your code that you have to go through and clean up)




Apart from that... the only other advice I can think of is that if a problem seems too big or complex, just break it down into smaller steps and then tackle each step individually.
Last edited on
closed account (j3Rz8vqX)
Another advice, would be, to properly think about the tasks at hand and the necessary procedures required to finish the tasks.

If you are designing as you code, you may forget your objectives; this is significantly critical in larger scaled projects.

Edit: adjusted grammar for legibility purposes.
Last edited on
From what I learned anyone can learn syntax and be knowledgeable on the concepts,but real programmers find clever solutions to problems.
Turn compiler warning level all way up. And pay attention to both warnings and errors.
90% problems in the beginning section can be solved by simply reading warnings/errors
Turn compiler warning level all way up.
+1
Learn to use and love your debugger
+1
Also , solve as much problems as you can , especially algorithmic or logic-intensive.
As a programmer you need to develop a different perspective on problems which comes slowly and with practice , much like mathematics.
Find a good balance of reading / absorbing knowledge, thinking / problem solving, and coding / making things. Make sure you do enough of all three.

Also, be a lazy programmer, but not a lazy thinker. Be really active about figuring out how you can increase your productivity, reduce the amount of tedious or repetitive work you do.
Last edited on
Topic archived. No new replies allowed.