- Home /
is there a such thing as a script that is too long?
i have written a C# script in MonoDevelop and its about 4000 lines long. whenever im working on that specific script after a while MonoDevelop crashes. Im just wondering if there is a limit to the length of a script that would make MonoDevelop crash. i dont know why its crashing, what should i do to find out why? thank you for your time.
Answer by Kiwasi · Aug 20, 2014 at 04:39 AM
4000 lines is too long, at least for readability and maintainability purposes. Consider doing some serious refactoring.
Ideas to consider
Make your code DRY. Anything you do more then once should be in its own method
Split the script into multiple classes in multiple files. Each class should have one task to do, and one task only
Use intelligent data structures to reduce the amount of space needed for variable declarations
I have no idea if the length is causing MonoDevelop to crash. Its possible that the auto error checking is finding your code to much to deal with.