Live data from Hacker News

A project with a single 11,000-line code file

austinhenley.com

11–20 of 346 posts

Re: A project with a single 11,000-line code file

#11

I once refactored a 15k plus line sql file. Fun times

I'm guessing / hoping there was a lot of data in there as INSERT statements.

My horror story was being asked to do maintenance on PHP sites written in the early days of PHP. Hundreds - maybe thousands - of PHP files with copy-pasted HTML and intermingled logic. As far as I can tell, the idea of instantiating a whole MVC framework from a single entrypoint file came after that particular site was created, so every possible page was its own entrypoint with its own boilerplate. Source control also seemed to predate this project, so you had plenty of .old.php and .old.v2.php files.

Programming at webdev agencies is a challenging experience.

Re: A project with a single 11,000-line code file

#12
post #7

The number of lines in a file doesn't necessarily mean anything. SQLite is compiled as a single file: https://www.sqlite.org/amalgamation.html . It depends on the structure that is in that file. If this app was factored into 300 different files, it would still be an impossible mess. The redundant and buggy logic would just be in different files.

SQLite concatenates its sources into a single file to ease distribution, but it is developped in many seperated and well organized .c and .h files.

Re: A project with a single 11,000-line code file

#13
Debugging a single file is much easier compared to debugging a tangled mess of interconnected .h, .c, .tcc files with include directives that only work in a specific sequence and with a specific compiler.

Fix your include/import systems before preaching for modularity.

Re: A project with a single 11,000-line code file

#16

A brilliant tool I once worked with is TetGen; it takes a hollow 3D shape and creates a volumetric, space-filling mesh of the inside using tetrahedra. Most of what is TetGen is in once giant C++ file, clocking in at 36,566 raw SLOC. https://github.com/libigl/tetgen/blob/master/tetgen.cxx

But it’s a class with lots of small methods. Maybe not the same as the single large VB script the OP described.

Re: A project with a single 11,000-line code file

#19

I once inherited a mission-critical PHP project which had no version control, no tests, and no development environment (all edits were made directly on the server). It used a custom framework of the original author’s own devising which made extensive use of global variables and iframes and mostly lived in several enormous PHP files. I was able to clean it up somewhat, but there was one particularly important file tha…

Haha, same!

The first project I inherited was PHP app that used a custom UI framework created by an agency that didn't work with us anymore.

One file had 7000 LoC and it would generate hundreds LoC of with-sprinkled JS code and send it to the browser on every click.

Debugging that thing was a nightmare.

Post reply on HN