I have a website built with ASP.NET (.NET 2.0). I have a lot of classes in my business logic, and I keep all of them in one file (BL.cs).
I now got to a stage where I have 11,000 lines of code in this file. Is this a problem - should I separate it into several files, each class in a different file? Is there a limit that the cs file shouldn't exceed?
I stick to the following rule: 1 file per class (unless for nested classes of course). 11,000 lines of code in a single file looks monstrous.
You should keep each class in separate file for better readability and managability.
To be honest I don't know if there is a size limit, but 11.000 lines of code is a lot to handle in a single file.
You will find that VS runs a lot smoother if you split the code into multiple files and it will make it easier for you and your fellow developers to focus on a specific set of classes for any given task.
Programming is all about building complex systems from simple parts. Storing all your parts in a single, giant file goes against that idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With