A project with a single 11,000-line code file
61–70 of 346 posts
Re: A project with a single 11,000-line code file
#62It really speaks to the state of software engineering when there are ample comments here defending this practice. This is virtually indefensible in my book, as it screams technical debt and strongly suggests that there are much deeper issues hiding in that codebase. Personally I would not be willing to work on it without first addressing those issues.
A 10k single line program can be easier to understand and better organized than an overly abstracted mess strewn across multiple files, but which checks all the "best practice" checkboxes.
Re: A project with a single 11,000-line code file
#63Earlier quoted context omitted.
You sound like you should read this: [removed] apparently jwz decided not to be linked from here :/ there's an archive.org link below.
Heads up: jwz.org redirects Hacker News visitors (via "Referer") to an image of a slightly-hairy testicle sitting inside an egg cup. So maybe don't click the link at work.
Re: A project with a single 11,000-line code file
#64If 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.
$ wc -l perl/lib/Sys/Guestfs.xs
11930 perl/lib/Sys/Guestfs.xs
Worse still, this expands to C which can be large and takes a noticable time to compile: 30019 perl/lib/Sys/Guestfs.cRe: A project with a single 11,000-line code file
#65Yet! Those non-programming people somehow managed to add their little requirements over the years, without breaking the other forms?
There is probably more to the story. Like that, I suspect, users who needed to produce a certain form probably had private, years-old copies of the program that they used, impervious to subsequent changes.
Re: A project with a single 11,000-line code file
#66That 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
#67If 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
#68So 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
#69Re: A project with a single 11,000-line code file
#70I don't get the obsession with file length. What's the benefit of having 100 files with one 50-line function per file, over having a 5000 file with 100 functions? Obviously not counting extreme cases where the file size would break some editors' buffers
Ability to search through your codebase by file name
Ability to hide irrelevant information and expose a higher level API through private functions