managing projects

Started by
7 comments, last by Emmanuel Deloget 19 years, 2 months ago
Hello, i'm doing some fun stuff in openGL and C++, and am wondering how the experienced among you manage bigger projects ( using different files, header files, classes etc...). I just started using Dev-C++ instead of Borland Builder. Any advice, comments ... Thanks
Advertisement
All i use is a console and text editor. This is also how i build my web sites. My only good advice would be to have a very specific and divided file system (lots of sub-directories) and always plan for expansion, even if you don't think you'll ever get that far. Sometimes projects just evolve big, they don't start out that way.

Lots of subdirs.

Also, try to put one class to a .cpp/.h pair, or at least make them all related classes. On that note, give your files the same names as the classes they contain. That's only reasonable.
When writing code, I always try to imagine how some other programmer would react when he's got my classes in front of him and needs to use them in his own code. The public interface (aka API) of all components has to be as intuitive and simple as possible. In larger projects, this other programmer can soon be you, when you don't remember the details anymore some weeks later ;)

Apart from that, finding good, rememberable terms for any concept and module of a project is very important. And the larger the project, the more components it should be breaken down to. Use multiple .dll/.so based components, namespaces to seperate the various units in code (like eg. "Math", "Audio", "Storage"), don't write one large "renderer" class, create 10 smaller ones which do the job. And keep your files organized, filename-wise and with multiple subdirectories, as my foreposter said.

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
It's pretty much unix standard to use one include/ and one source/ (or src/) directory so I use that. I use pretty much one file set (.h+.c++) per class, this is best in the long run as the classes grow you want it this way...

When we are several developers on a project (which we often are) we generally try to avoid editing the same files and make sure we check in files in the repository ("backup" system, check http://subversion.tigris.org for instance) in turn to not make files screwie.

For all *nix based platforms (right now linux and mac os X) we use Makefiles (with autoconf (configure scripts)) and windows we use whatever visual studio uses, I'm not familiar with the .net editor at all.

Binaries such as game data is never an issue, that usually works by itself since one artist is often working on one file at a time.

Make sure to design your project first, even the smallest things for hours of thinking sometimes, because then you will probably code smarter classes, which will be both modular and extendable. You will own that hours spent on designing many times over on a larger project.

Bah, just me ranting
Albert
-------------------------------------------http://www.thec.org
I think, managing a big project will be easier if you use Microsoft VisualStudio .NET, because, it has a "Solution Explorer". But, Microsoft VisualStudio .NET is too expensive, same as Borland C++ Builder (I never try Borland C++ Builder before).

The another better way is to use Bloodshed Dev-C++, a GNU C/C++ IDE. Bloodshed Dev-C++ is a good GNU C/C++ IDE, so you can easily manage and linking your big-project's files. So, I think there were no problems in managing a big project with Dev-C++.
Thanks for the replys.

Peter
Out of curiosity, why do people put extranious code in .cpp/.hpp pairs? Why not just in a .hpp file and leave it at that?
Quote:Original post by Think128
Out of curiosity, why do people put extranious code in .cpp/.hpp pairs? Why not just in a .hpp file and leave it at that?
There are three stages to compilation: source code -> (compiler) -> assembly code -> (assembler) -> object code -> (linker) -> binary executable.
Doing it all with one .cpp and a whole bunch of .h files generates only one object file. This means that everything must be recompiled every time a change is made...

In a large project, these compilation times can grow quite large, so what people do is they seperate everything out so that it can be compiled into multiple object files which are only recompiled when a file they depend on is changed.

[Edited by - lucky_monkey on February 16, 2005 3:06:06 AM]
Quote:Original post by Think128
Out of curiosity, why do people put extranious code in .cpp/.hpp pairs? Why not just in a .hpp file and leave it at that?


Two answers:
1) if you speak about having one file for the whole project:
lucky_monkey gave you a correct answer. Here is the figures: I have worked on a professionnal film scanner driver+software for the past 5 years. The directory tree contains 42 MB of source code. It is included in a more important project - a minilab management software (>160 MB). In the end, our source tree contains more than 200 MB.

That would be a rather big file :)

2) if you speak about avoiding using cpp files and use only hpp file:
C++ != java. hpp files are not compiled if they are not included in at least one cpp file (unless you specify really weird compiler options).
C++ uses a declare/define paradigm, which allow you to forward declare and define later. This is the primary reason for having the cpp/hpp duality.

Regards,

This topic is closed to new replies.

Advertisement