I am looking for tips for programming. I am in the second course for C++ and am wondering if there are any tips or any good habits you guys have, especially for those that have coded for a job.

Right now, when I start a project, I just sit down and code. This is ok for now, I think, but that's because the project is relatively small and simple. How does it work in the real world? I've heard that when one writes a function, they should test it immediately, so that if there are any bugs, you know from what function they are coming from instead of looking at the entire project. Does this sound right?

Any suggestions, tips, whatever will be very helpful. I don't mind links either. Thanks in advance.