views:

33

answers:

2

To explain my point further, I'm a beginner in programming, and I'm working on a small project.

Instead of separating the .cpp file from the header file, I'm implementing the code in the header files, and making one .cpp file for testing. I do this to have less files, hence easier navigation. Then later I'll separate the code as it should be.

Will this cause any problems? should I continue doing that?

Thanks.

A: 

I guess you're just not used to C++ (or C) where header/source separation is an important design decisions (quite differently from, say, Java or Python, where no such distinction applies). I strongly recommend that you "go with the grain" of the language you're using instead of trying to use it "as if" it was a different language that you're more familiar with!

Any decent C++ IDE will give you trivially easy navigation with the header/source split (since that's how all C++ code out in the real world is actually done;-), so that's not a good reason to "go against the grain" of your chosen implementation languages.

Alex Martelli
+1  A: 

No, better to keep it separated. It's like weight training - you should always use good technique, even if you're just starting and lifting only a little weight.

You don't say "can i use bad technique for now, and switch to good technique when i start lifting heavy weights?" The point of using light weights is to learn the right technique, similarly the purpose of these beginner projects is to learn to do things right, so that's what you should do.

Larry Watanabe