mosra / magnum-bootstrap

Bootstrap projects for the Magnum C++11 graphics engine

Home Page:https://magnum.graphics/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separate declarations from implementations

severin-lemaignan opened this issue · comments

Currently, the bootstrap projects include the class declarations in the implementation.

Is there any good reason not to provide separate headers (which are needed as soon as the project grows up)?

I can submit a pull request for that, if needed.

Good point, thanks. Actually it was originally done this way, but later I decided to use headers only when they are really needed (in particular, included by more than one source file). In my opinion this is similar to main() function -- the source file commonly doesn't have any corresponding header, because main() shouldn't be used in any other way than as an application entry point. This approach is used for "main" classes in all examples and other projects and also in all unit tests. On the other hand, classes other than the main one always have their declaration in separate header file.

There surely might be some reasons why to not go with this approach, I chose it mainly for its simplicity.