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.

  • 2
    Your workflow is fine. There isn't a "set" way to develop. You have all the main steps (and additional ones as well.) If it works for you, keep doing it! – Starkey Aug 21 '11 at 22:39
  • 1
    Throw in "take a break" somewhere in there too. Too many programmers waste hours trying to fix an issue when taking a 15 minute break will be much more beneficial to them. – BlackJack Aug 21 '11 at 23:20
  • 2
    For a C++ beginner, an "ask for a code review" should be added now and then. – Sjoerd Aug 22 '11 at 2:28

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.

| improve this answer | |

You forgot something ... thinking. Programmers don't do enough thinking.

Think -> Design -> TDD -> code -> Think again -> cppcheck -> valgrind -> debug -> repeat until ready to use profilers and coverage mechanisms -> Think some more

| improve this answer | |

Don't fall into the guess & check trap of c++ programming. That is, don't get into a tight edit -> compile (get error) -> edit loop w/o understanding what is going on.

If you don't understand why adding an ampersand or removing parenthesis fixes a compiler error/warning then take the time to understand.

Excellent resource for understanding the idiosyncrasy of c++: http://www.parashift.com/c++-faq/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.