Programming Style and Proper Structure

Started by
1 comment, last by pointguard1 22 years, 5 months ago
Is it OK(proper coding technique) to have 1 .cpp file in my project that contains all the main routines and main functions like Init(), DrawScreen() and Shutdown() and put everything else like class defs and DX wrappers in my header files?
------------------------------------KaBeeM Web
<><
Advertisement
No. Each .cpp file is a module. If your project grows to even a modest size, you''ll doubtless have parts of code that change where other parts are the same. If those parts are separated into different modules, you''ll only need to recompile modules that have changed and re-link. If you only have one .cpp file with all the code in headers, the entire program must be recompiled for every change.

I find you can''t go wrong with following a two-file-per-module scheme: each .cpp file has code for the module (however you want to define the parts of your program), and a single associated .h file that _only_ includes information that other modules need about that module.
thnx
------------------------------------KaBeeM Web
<><

This topic is closed to new replies.

Advertisement