this post was submitted on 12 Jul 2023
31 points (79.2% liked)

Programmer Humor

32461 readers
818 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 1 year ago (4 children)

8,000+ lines in a single file??? I’m going to be sick

[–] [email protected] 13 points 1 year ago (2 children)

Oh that's not uncommon in the industry. Especially when dealing with legacy code.

Personal best was 40k lines in a file called misc.c containing all the global functions that don't fit anywhere else.

Runner up was the one where each developer dumped their miscellaneous functions in their own files, so they don't have to deal with merge conflicts. Which means we had x1.c, x2.c, x3.c ... etc.

[–] [email protected] 8 points 1 year ago

Oh trust me, I know. Personal best is 20k lines in a Java file that served as the main control flow of the entire software. Just because it’s common doesn’t make me any less disgusted 😂

Thankfully now I’m the asshole senior who gets to prevent this kind of stuff from happening in the first place. But like you said, that doesn’t help with legacy applications lol.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

Best I can offer is a combined UI and logic class with 12,500 lines currently. It started out with less than 3,000 lines in the year 2000 (using the brand new Java 1.3), grew to 14,000 over time and survived our recent project-wide one-year cleanup project with only minor losses of code lines.

[–] [email protected] 2 points 1 year ago

I was kinda hoping you were gonna finish that first sentence with "in a java applet". Cause that would've been awesome.

[–] [email protected] 7 points 1 year ago (1 children)

I work for one of the mega corporations as a decently high level software engineer. My team's job is to maintain legacy code. This is my life. 😞

[–] [email protected] 3 points 1 year ago

Ah, a fellow janitorial staff. Some of these shit have been there so long they've seeped through the walls. There's no way to get rid of them, short of demolishing the whole building.

[–] [email protected] 4 points 1 year ago (1 children)

You should see Firefox source code, there are many files like that. Honestly it's better than having 100,000 files which is what would happen with the size of Firefox.

[–] [email protected] 2 points 1 year ago (1 children)

As someone who professionally works in a project with many, many thousands of files (I don't know the exact number right now, but we're coming close to 10 million lines of code) and many of them having thousands of lines (see my other comment): No, longer files is not better than more files.

[–] [email protected] 1 points 1 year ago

It depends, obviously if stuff is unrelated than they should be in separate files, but having in one folder 1000 files containing each function I think that would be very exhausting to search through to understand the code.

[–] [email protected] 3 points 1 year ago (1 children)

That's not even that much. I've seen longer!

[–] [email protected] 1 points 1 year ago

...that's what she said

[–] [email protected] 11 points 1 year ago

Yep, Longest Common Subsequence is usually greedy and that’s the earliest set of lines that satisfies the search. Happens when you just treat a file as lines and only match those.

You can get better results with more syntax or content awareness. Chunk into paragraphs or code blocks or functions, then sentences or statement lists, then lines, then words, etc. I think Beyond Compare can do this.

[–] [email protected] 1 points 1 year ago (1 children)
[–] [email protected] 3 points 1 year ago

Its okay, I've only used it for contributing to firefox so I'm not that familiar.

load more comments
view more: next ›