←back to thread

-2000 Lines of code

(www.folklore.org)
499 points xeonmc | 1 comments | | HN request time: 0.199s | source
Show context
impostervt ◴[] No.44386164[source]
About 1.5 years ago I inherited a project with ~ 250,000 lines of code - in just the web UI (not counting back end).

The developer who wrote it was a smart guy, but he had never worked on any other JS project. All state was stored in the DOM in custom attributes, .addEventListeners EVERYWHERE... I joke that it was as if you took a monk, gave him a book about javascript, and then locked him in a cell for 10 years.

I started refactoring pieces into web components, and after about 6 months had removed 50k lines of code. Now knowing enough about the app, I started a complete rewrite. The rewrite is about 80% feature parity, and is around 17k lines of code (not counting libraries like Vue/pinia/etc).

So, soon, I shall have removed over 200,000 loc from the project. I feel like then I should retire as I will never top that.

replies(2): >>44386217 #>>44386712 #
1. Cthulhu_ ◴[] No.44386712[source]
> I joke that it was as if you took a monk, gave him a book about javascript, and then locked him in a cell for 10 years.

I've had a similar experience (see other comment), the original author was a junior developer at best, but unfortunately, a middle-aged, experienced developer, one of the founders of the company, and very productive. But obviously, not someone who had ever worked in a team or who had someone else work on their codebase.

Think functions thousands of lines long, nested switch/case/if/else/ternary things ten levels deep, concatenated SQL queries (it was PHP because of course), concatenated JS/HTML/HTML-with-JS (it was Dojo front-end), no automated tests of any sort, etc.