Thread: Project folder maintanence

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    347

    Project folder maintanence

    Hi all,

    I have this problem and do not know how to resolve this. Suppose i have started working on a new project example C based project how should i maintain my folder structure? how to track the changes i am doing in the code continuously? When should i approximately take the backup of my code? Could someone please suggest me methods to properly maintain my project and if i visit my project say after one month how could i easily recognize the project file names. Please suggest me some ideas. sorry if it is a stupid question.

    Thanks in advance,
    regards,
    Satya

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Satya
    how to track the changes i am doing in the code continuously? When should i approximately take the backup of my code?
    Use a version control system.

    Quote Originally Posted by Satya
    Suppose i have started working on a new project example C based project how should i maintain my folder structure? (...) Could someone please suggest me methods to properly maintain my project and if i visit my project say after one month how could i easily recognize the project file names.
    Perhaps you should give us an example of what you are doing right now and what problems you are facing with it. You could also take a look at open source projects written in C for ideas.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    first of all, use a version control system like git. apart from that, do what makes the most sense to you. but the generally accepted practice is to have source (C/CPP) files in one folder, often called "src," and header files in another folder, often called "include."
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  4. #4
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    I have a million folders in a million places with incoherent naming schemes. As far as I'm concerned, this is the only way of doing things.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Using an automatic backup system (such as Dropbox) isn't a bad idea either to backup your changes between your commits to the version control system.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Elkvis View Post
    first of all, use a version control system like git. apart from that, do what makes the most sense to you. but the generally accepted practice is to have source (C/CPP) files in one folder, often called "src," and header files in another folder, often called "include."
    I've never seen any benefit to keeping headers in a separate folder.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  7. #7
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by brewbuck View Post
    I've never seen any benefit to keeping headers in a separate folder.
    Easier to write install scripts?

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by manasij7479 View Post
    Easier to write install scripts?
    This argument is often made. However, the need to install large numbers of header files is a sign of bad API design. You are leaking far too much internal detail if you are copying all of your headers as part of an installation.

    It makes sense to keep externally-visible headers in a separate location but that vast majority of your headers shouldn't need to be in there.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    However, the need to install large numbers of header files is a sign of bad API design. You are leaking far too much internal detail if you are copying all of your headers as part of an installation.
    O_o

    I see your generalization and raise you any C++ library heavily dependent on templates. Of course, I prefer all of my headers to be "bite sized" so even my C code uses a lot of external headers.

    You can easily "leak" internal details, but the number of headers is unrelated to "bad API design". You could easily use GCC to "compress" all your headers into a single file, but that doesn't magic away bad design.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by phantomotap View Post
    You can easily "leak" internal details, but the number of headers is unrelated to "bad API design". You could easily use GCC to "compress" all your headers into a single file, but that doesn't magic away bad design.

    Soma
    It isn't directly about the number of headers. A project with two headers could suffer the same faults. The problem is the lack of proper design to separate the library API from its implementation details. Dumping all your headers in a single folder then shipping the entire thing is equivalent to just throwing your hands up.

    As far as C++ template libraries, those are a messed up case that isn't really covered by what I just said. That's a language problem.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  11. #11
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    A project with two headers could suffer the same faults.
    O_o

    You've correctly identified my point.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 08-02-2013, 06:45 PM
  2. Replies: 5
    Last Post: 02-23-2013, 03:37 PM
  3. Replies: 4
    Last Post: 03-29-2012, 02:55 PM
  4. Clean Windows Temp folder and the User Temp folder?
    By patrick22 in forum Windows Programming
    Replies: 11
    Last Post: 01-27-2008, 04:29 PM
  5. deleting a folder AND copying a folder
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 05-01-2004, 08:48 AM