My project seems to be getting bigger and bigger, and some of my classes are thousands of lines long. It’s too difficult to view them every time I want to make changes.
I find that JavaScript is not as easy to lay out as some other programming languages. So when the classes go through a few thousand lines, I have trouble reading.
I tried to split it into several files, but then you break classes, which seems wrong. For example, if each method in a class uses a global variable, you can find the global variable in only one of the files in this class.
Also, if I want to use JavaScript code from 100 different .js files, I get something like this ...
<script type="text/javascript" src="Scripts/classes/Node.js"></script>
<script type="text/javascript" src="Scripts/classes/Queue.js"></script>
<script type="text/javascript" src="Scripts/classes/DblyLinkedList.js"></script>
.... 97 more lines like this
Although, I thought there might be something that I can do ...
<script type="text/javascript" src="Scripts/.../*.js"></script>
or something like that ... is that right?
Does anyone have any tips on managing code when it reaches its extremes?
Tips for clearing JavaScript code will also be helpful.
Matt
source
share