-
creating big projects
i never wrote a big project but i am starting now :) but the problem is how do you wrote your projects i want to have a main menu and sub menus all do diffrent jobs but if i make a one big file and a case statement it is going to be a makaroni code how do you manage a project like that?
-
"if i make a one big file and a case statement it is going to be a makaroni code"
Only if you poorly code it.
"how do you manage a project like that?"
I don't have any experiece doing it for a large project, but I would imagine you would divide things up into functions, all with their own .cpp files and .h files.
-
project management is essential. if you need classes, then .h/.cpp will be best. or if you want fxns to be written outside of your main .cpp file, then you can declare them in a .h file and define them in a .cpp file.
it's up to you and however you see best. design decisions coming into play.
-
Definitely split the program into separate files. What you split depends on your code. I usually place one class per file, and if there are many functions they are split into separate files depending on their purpose.
I'm working on a game which itself is nicely structured. I'm also having a level editor for it, but I placed all the code for it in one single file. I never thought it would grow so big. It is currently almost 4000 lines making it very hard to maintain. Don't make my mistake :).
-
The menus should be easy to keep "clean".
Each menu selection can call one function, which may be a sub-menu. Then, that one function can call the other functions as required for the particular choice.
Here at work, we have programs with a screen-full of choices (maybe 20 options). The menu function is short and separated in it's own file.