C++ Beginner Workflow – Best Practices and Tips

ctddworkflows

I desire to become a more serious scientific C++ programmer. To do so, I need a consistent style of workflow (e.g., coding, test-driven development, etc.). My question is simply what sort of workflow should I consider? I am familiar with Linux and Mac, and prefer to use free tools like cppcheck, valgrind, g++, etc. I prefer to use Qt and Boost within my programming toolbox, and I am considering using mock objects (either Google Mock or MockPP) within the TDD. I typically use vim for my editor.

In essence, should I do something like the following:

TDD -> code -> cppcheck -> valgrind -> debug -> repeat until ready to
use profilers and coverage mechanisms

or, should I pursue some other way? I realize that the opinions will vary, and I also understand that I must first take the time to think through the process and document my thoughts whether written or UML before coding, and I also know that I should document the code as I step write the code.

Any and all thoughts will be appreciated.

Best Answer

First read C++ annotations. It's free and online.

Honestly I don't think you're best off starting with TDD. TDD is really cool once you realize its true value. And to do that, I believe you've got to have your share of agonizing debugging.

So first you might want to just implement some random programs in C++. Just make-up games and such, or find some people who want things done (and maybe get some money out of it). Take your implementation seriously.

Then, once you think you're really good at programming (at this point, programming for you will probably stand for "making super complex things ultimately - and magically - work), read some books about Testing. Watch some GoogleTechTalks about testing.

Good authors you should remember: Robert C. Martin, Michael Feathers, Martin Fowler, Kent Beck. Then search for some videos about clean, testable code by Misko Hevery from Google.

Related Topic