The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
Your return could've been a bit more dramatic.
I was thinking something like "Mortals! Thou hath awakened me from abyssal sleep. State thy business!"
Now it's just a bit of an anti climax
Missed opportunity, really...
I was recently given a Windows form application to work on. It was done as a single form with over 24,000 lines in the code behind file. I was taught that no file should be over 1,000 lines. Maybe 2,000 if a lot of repetition was required. What do others feel about the maximum size of a single file?
Not also the single form had nested tab containers with over 600 controls on this singe form. They went as much as 5 deep. It was an abuse of the Window Forms framework in many aspects. My question is only about code file size.
So many years of programming I have forgotten more languages than I know.
I was taught that no file should be over 1,000 lines. Maybe 2,000 if a lot of repetition was required. What do others feel about the maximum size of a single file?
By who?? Anytime you put a limit on th enumber of lines, you're asking for trouble. What if the limit's 1000 lines and you need to insert 3 more lines to fix something?
The size of the code file is irrelevant. You can have a large file, well written and maintained, that works fine. You could also have a small file with 20 lines that's crap and needs to be thrown away.
From a UI perspective, it does sound too busy. From that angle, I'd consider redesigning it.
This whole thing smells of an old, legacy code app that can't/won't be refactored from some reason.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
Single responsibility principle.
A class should do a single thing, meaning it has one reason to change (or something like that).
I find that my classes are rarely larger than a few 100 lines.
I recently wrote one of about 600 lines and it felt like an absolute beast to me.
I can't really put an upper limit on lines per file, but 24,000 in a single class is WAY TOO MUCH. Period.
That's just unmanageable.
The tab containers, for example, should've been in their own files.
You look at the solution and you see OrderForm.cs, TabControl.cs, MyTextBox.cs, OrderRepository.cs, etc. and you know what kind of work you can expect.
Looking at a solution and seeing only OrderForm.cs, but with 24,000 lines tells you nothing of what is going on or where to find it.