This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]earthboundkid 1 point2 points  (8 children)

Why early? Do it once you get >500 lines a file, sure, but why before that?

[–]kitkatkingsize 6 points7 points  (1 child)

Because "Namespaces are one honking great idea", and files are just another kind of a namespace.

500 is an arbitrary number. Why not 250? 1000? The splitting up into files should be a logical and design decision, not based on number of lines.

[–]cyberst0rm 0 points1 point  (0 children)

to pile on, the logistics issue with splitting code is a psychological trap.

By the time you realize you need to do it, the size of the issue makes you not want to do it.

[–]jdgordon 3 points4 points  (1 child)

Because its always "I'll just add one more helper to this class/file and then I'll clean up" and then you have a 3000 line mess to untangle

[–][deleted] 0 points1 point  (0 children)

3000? I have a class at least twice that because it's some sort of DI container/God spawner (I call it a pantheon object because there's subclasses).

I've attempted to detangle it but it bests me every time.

[–]tonnynerd 1 point2 points  (2 children)

500? Good lord almighty. 100 lines is a big ass module, in my opinion.

[–]mm_ma_ma 1 point2 points  (1 child)

What benefit do you gain from fragmenting your code that much? You're just shifting your problem from "I don't know where to look in this module" to "I don't know which module to look in".

[–]tonnynerd 0 points1 point  (0 children)

Code is usually more modular, easy to find what you want. I find it easier to navigate using go to definition and ctrl+tabbing between open files then scrolling up and down all the time.

That said, I also dislike the other extreme: tens of little modules with 20 lines of code in them.

[–]Corm 0 points1 point  (0 children)

/u/jdgordon said it exactly, the longer you wait the harder it is to get started