Sign in to follow this  
austriancoder

Bigger project and folder structure

Recommended Posts

Hi all. I want to start a bigger project and want to avoid some problems from the beginning. Lets say i have several parts, like fileio, pattern, graphics, sound, scripting and so on. Should i make subfolder now? My-Project -- src ---- fileio ---- pattern ---- graphics ---- sound ---- scripting or should i put all my source files in the root-folder? How are you doing this? Thanks, ac

Share this post


Link to post
Share on other sites
Its personal preference all the way on this one. No-one can tell you how much organisation you need in your project.

I personally put all my source files in one folder. As long as I name them sensibly, I can easily find what I want just by knowing the alphabet.

Having said that, in my project work space I do use folders, and some people might think it is confusing not then using folders on disk. But thats up to them :)

Just make sure you know where your source is and you can easily find it. What method you use is, as I said, going to be different person to person.

Spree

Share this post


Link to post
Share on other sites
I use folders on disc and in the solution file. The folder structures are identicle. I'm only using folders like this now because custom include/lib directives are broken in Express Beta2. A better solution is to use seperate libraries.

Share this post


Link to post
Share on other sites
I personally think that using separate folders for different "parts" of my project is the way to go, but I usually start of with all sourcefiles in the root folder, and then when I see that the project is going somewhere, I organize it.

One thing that I always use is a separate output folder, so that my source dir doesn't get clobbered with compiler output (*.obj, *.err and stuff like that). I'm not using any IDE like DevCpp, Code::Blocks or MS Visual Studio, if you don't count make as an IDE, and I've noticed that keeping the sources in order helps me to keep the makefile more readable and easier to maintain. Separate folders for the final output both in release and debug-mode is also a nice option. But then again, it's just me... My "Downloads" folder is very structured too [smile] but that's another story.

Share this post


Link to post
Share on other sites
I use subdirectories extensively to mirror the code heirarchy in the filesystem. Keeping everything explicitly heirarchial seems to encourage modularization. I'm developing in C, so I use underscores to separate heirarchial elements in the code (in the same way / is used in the filesystem). For example, the non-static (ie: public) identifiers in the file src/res/pipe/in/ar.c are prefixed with res_pipe_in_ar. Of course, this might be more effective in C++, where you could use namespaces and the using keyword to lessen the long identifier problems with deep heirarchies.

Share this post


Link to post
Share on other sites
I once used many subfolders for a project thinking it would give me better structure. The problem is that later on you will not know where to place certain files and will have trouble finding em later on. However having 300 files in a single folder is a bit messy so my advice is to use a few very sepperate modules, such as "sound", "graphics", "math", etc. There will still be some confusion on where to place some of your files. But much less than if you have alot of folders (in my project I had like 20, and it is not recommended).

My 2 cents..

Share this post


Link to post
Share on other sites
our structure


foo ->
| bin - contains files that arent added too the cvs or svn
| dbg - contains objs and other compiler things
| rel - --||--
| src
| private - contains files that arent added too the cvs or svn


external - contains third party libs

docs - doxygen, html etc

bin ->
| release1
| release2
| ...
| release[n]




all src folders are made up by the foo structure


download a big opensrc project and look how they do...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this