Live data from Hacker News

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

austinhenley.com

31–40 of 346 posts

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

#34
If well done, single file projects are not bad. They save a lot boilerplate code. It is also easier to find things, since it is all in the same file.

EDIT: I'll go even further. Programmers who don't like long files are probably using the scrollbar to navigate around the file. Vim saves me from that bad habit.

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

#35
I've never written a file with 11,000 lines of code, but I have often built Clojure projects like this, with everything in one file. I think I might have once had a file with 4,000 lines of code. Maybe 5,000? A complete system might be 5 apps, working together, each made of one large file. It does help with some things. Especially if I try to on-board another programmer, if they don't know Clojure very well, using one file means they don't ever get tripped up by name spaces, instead, they just open one file, and then they can load it into the REPL and start working. I would not recommend this style for every project, but it does offer a kind of simplicity for the projects I work on.

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

#37
post #9

That beats the 1000 lines inside a single if {} block that I once found. (The conditional in that if {} always evaluated to true).

Lol, reminds me of the meme:

var a = true;

if(a == true) then return true;

else if(a == false) then return false;

Or something like that.

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

#38

If well done, single file projects are not bad. They save a lot boilerplate code. It is also easier to find things, since it is all in the same file. EDIT: I'll go even further. Programmers who don't like long files are probably using the scrollbar to navigate around the file. Vim saves me from that bad habit.

What programming language requires 'a lot' of boilerplate code to use multiple files? That sounds awful. I don't think the argument for things being easier to find goes up either, with a tool like grep.

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

#39
So afraid to write bad, spaghetti code, I ended up writing no code at all.

This thread made me realize that it's better to have a working profitable project with bad code, than a perfect unfinished project, with meticulously chosen design patterns.

Afraid of being judged for bad code, I could not start until I had the right architecture.

I'm glad I read this.

This is developers therapy.

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

#40
CORSIKA, current Version 7, is a program to simulate extensive air showers, ie particle physics in the atmosphere.

It's main file is 88kloc Fortran 77, started in the eighties, still actively developed.

https://www.iap.kit.edu/corsika/index.php

Currently a rewrite in c++ is underway.

Post reply on HN