this post was submitted on 22 Jun 2023
27 points (100.0% liked)

Programming Horror

1837 readers
1 users here now

Welcome to Programming Horror!

This is a place to share strange or terrible code you come across.

For more general memes about programming there's also Programmer Humor.

Looking for mods. If youre interested in moderating the community feel free to dm @[email protected]

Rules

Credits

founded 1 year ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] jnovinger 6 points 1 year ago (1 children)

This is my favorite/most horrifying part:

The control flow is so labyrinthine that some of the code is actually indented by 23 tabs. Forget the 80-column rule -- these lines don't even start until column 92! Even if we discard the inline data tables, then the longest line in the codebase is still a whopping 387 characters long (you'll have to scroll to the right to read it)

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

This bit made me laugh the most:

The TerrariaClone.init() method, which is over 1,300 lines long, actually grew so large that it hit the limit hardcoded into the Java compiler for the maximum memory that can be taken up by a single function! The solution? Copy half of the init() code into a new method, called codeTooLarge(), and call that from init().

[–] porgamrer 1 points 9 months ago

Is that really true? I swear I've seen java codebases with methods thousands of lines long. What can possibly overflow in such a small amount of code?

The only thing that sounds possible to me is a value stored as a u8 or u16 in the bytecode format, with the assumption that methods are never very big, but that would still be surprising given that it's a stack based VM.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago)
load more comments
view more: next ›