21
The day I stopped writing all my code in one giant file
I used to just dump everything into index.js when I started learning. Six months ago I had a 800 line file and it took me 45 minutes just to find a single typo in a variable name. A guy on a discord server told me to break it into separate modules and I thought he was crazy. Last week I refactored that same project into 12 small files and fixed a bug in under 5 minutes. The difference in my brain power after just 3 days of working with modules was crazy. Has anyone else had that moment where you finally get why people preach about file organization?
2 comments
Log in to join the discussion
Log In2 Comments
christopher_craig13d ago
Ngl, I've been doing this for years and I still don't get the hype. Yeah, sure, splitting stuff up helps a little but 800 lines is nothing. I've seen people with 3,000 line files that work fine. Honestly, the whole "find the typo in 5 minutes" thing feels a bit dramatic. You can just hit ctrl+F and find it in like 2 seconds flat. Tbh, people act like file organization is some kind of life changing revelation when it's just a minor convenience.
6
the_jesse12d ago
Didn't I see you in that thread about JavaScript frameworks?
5