Live data from Hacker News

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

austinhenley.com

341–346 of 346 posts

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

#341
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).

Yeah, but the function only had a single exit point, so it was following best practices.

I don’t remember if it did or didn’t have a single exit point.

But the thing as a whole didn’t follow any best practices I’ve ever heard of: the project also had what looked like a bizarre attempt to reimplement the concept of properties(!), in that the UI classes had fixed length arrays of all their subviews, which were accessed by constants. Each section of the UI had its own god class, where different views in that section were all the same class, called with a constructor that determined if a view ought to be created for any given constant.

There were also something like 20,000 blank comments. No idea why, the guy who added them didn’t even understand my question:

  int something = foo();
  //
  double baz = bar(something, 5);
That kind of thing.

(The project is no longer available and the business who made it has since closed, before anyone asks).

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

#342
post #341

Earlier quoted context omitted.

Yeah, but the function only had a single exit point, so it was following best practices.

I don’t remember if it did or didn’t have a single exit point. But the thing as a whole didn’t follow any best practices I’ve ever heard of: the project also had what looked like a bizarre attempt to reimplement the concept of properties (!), in that the UI classes had fixed length arrays of all their subviews, which were accessed by constants. Each section of the UI had its own god class, where different views in th…

I was being tongue in cheek about people who religiously follow that "single entry and single exit to any function" rule and then get wrapped around the axle when a function needs to make several discrete sanity checks at the start before doing work.

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

#343
post #341

Earlier quoted context omitted.

I don’t remember if it did or didn’t have a single exit point. But the thing as a whole didn’t follow any best practices I’ve ever heard of: the project also had what looked like a bizarre attempt to reimplement the concept of properties (!), in that the UI classes had fixed length arrays of all their subviews, which were accessed by constants. Each section of the UI had its own god class, where different views in th…

I was being tongue in cheek about people who religiously follow that "single entry and single exit to any function" rule and then get wrapped around the axle when a function needs to make several discrete sanity checks at the start before doing work.

Fair enough, it’s hard to convey tongue-cheek position in writing ^_^

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

#344

Earlier quoted context omitted.

I think your examples are unfair. Getting stuck on needing the perfect architecture is closer to scrapping a building plan because it wouldn't hold up to a 2km asteroid strike than it is building something that will ultimately kill people. Also all of your examples have wildly different impacts than a dev "portfolio project". They all cause physical harm to people, which a poorly coded website/cli tool/etc almost cer…

Basic hygiene when cooking is not perfectionism, and is not only done at elite restaurants. Dismissing basic development good practices as "perfectionism" is just gaslighting people into believing that any form of thinking is overengineering.

> Basic hygiene when cooking is not perfectionism, and is not only done at elite restaurants.

Ok, so let's continue this analogy on the other one.

It's less like basic hygiene, and more like refusing to cook outside a clean room.

> Dismissing basic development good practices as "perfectionism" is just gaslighting people into believing that any form of thinking is overengineering.

Basic development good practices are something you develop during the "portfolio building phase", not before.

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

#345
post #313

Earlier quoted context omitted.

For a single modder, it may have to do with being a single developer, working on it over a long period of time and being a passion project. For a while, I was the only developer working in a small module of a bigger project: I started the code base, discussed requirements with clients, implemented the needed features, tested the whole product end to end. I developed a very good instinct about it and about what any ch…

This description has been life the last 4 years.

What are you working on?

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

#346

It 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.

I think the idea that optional extras are seen as required is more telling.

I suspect there are a lot of younger programmers with these views, who don't know elsewise.

Testing suites, having dedicated test/dev environments, all of these things are relatively new across most programming on the web. "Best practice" has changes more times than I can count in the last 20 years, and we've gone full circle from "monoliths are bad, split everything into microservices" to "maybe try combining them to reduce complexity".

I'm not saying this style of coding is the best, but automatically assuming the current practices are the definitive best ones in all cases is silly, and the idea you have to refactor because it doesn't meet those practices is - in my view - insane and wasteful.

Post reply on HN