As I program more and more, and as the project grows larger. It seems to get really hard to organize code. Specific questions I have for organizing code is:
-When to create a new script
-When the program gets large, I feel like the script I write turns into spaghetti code. Is it alright to have cross referencing or is there another way? For example I have a class that has a public list of "things". And for each of the "things" it has a reference to the class with the list. In my current project I have a script that only contains a reference to the class with the list(one line of code: public ClassName className;) Is this good practice??
-Recently I learned about singleton. I use this as a manager which menages other scripts. However I am getting confused on what class does what. Does the manager invoke the methods in the other scripts? What is the typical thing that a manager do and what does the other script supposed to contain?
-This is a little related to the last question but is it a standard to use a static class to handle certain behaviours?
-Are there any tips and tricks (ie. singleton) that would help towards organizing and or optimizing my project?
Thanks
↧