4 ms·
Rather than trying to figure out which of dozens of files has what you're looking for, you can just search one or two large ones. On the other hand, I hate fin
by userbinator 6y ago
Rather than trying to figure out which of dozens of files has what you're looking for, you can just search one or two large ones.
On the other hand, I hate finding a project that looks useful, but then the code is scattered across many files which are barely one screen long, or worse, also spread throughout different deeply nested directories. Regardless of whether the organisation makes sense, navigating directory trees is annoying.
- bigyikes 6y ago> Rather than trying to figure out which of dozens of files has what you're looking for, you can just search one or two large ones. Why is this a good thing? The same amount of code and same number of results need to be scanned either way. With many files, you at least have the file name to give you some small amount of context without needing to read the code.
- coder4life 6y agoWorking with 1 or 2 large files is vasty more productive/faster (for me) than working with 50 Seeing as Bellard is very prolific and has done more than you me and three others in a lifetime, there must be some merit to his approach.
- forty 6y agoExactly, I think it's trading write efficiency for readability. It's good for write only projects (so mostly personal projects I'd think)
- derangedHorse 6y agoAlthough I agree with the fact it was easier/faster for him, don’t fall into the fallacy of him being productive meaning he was efficiently productive
- andykx 6y agoYeah. This seems like something that the industry decided was a bad practice many years ago. My best guess is that this is more of a fun project than anything and spending too much time on such concerns would detract from the fun. I do the same with my side projects.
- chii 6y ago> you can just search one or two large ones. if the LOC is similar in size, i don't see why having them in different files vs same file makes any difference at all. Also, your IDE should be able to navigate you to definitions and usages etc. If it doesn't, it's not a good IDE. So the problem of understanding code reduces understanding the abstract structure, not how that structure is represented on file.
- z3phyr 6y agoYour IDE should be able to split a single file codebase into different readable modules. If it cannot do that, its not a good IDE. And slippery slope...
- breck 6y agoIs there a term for this type of refactor? Often I might end up with 2 exported classes in one file, both being used across other files. I then want to separate them into 2 files and update the imports. I feel like my IDE should be able to do this, I just can’t seem to google the right term.
- breck 6y agoAh, in VS Code it is just: 1. Click class name (or any other top level identifier). 2. Click light bulb. 3. Click move to a new fie.
- terminalcommand 6y agoDo IDEs really do that type of refactoring? As a long time Emacs user I long forgot what a good IDE is capable of. I know of automatic renaming, moving parts you select automatically to another file, but full automatic refactoring to multiple modules is something I haven’t seen. How does this tackle circular dependencies etc. I guess the IDE must parse the code, generate the syntax tree, populate symbol tables etc. and then make the refactoring. A side point I sometimes dream of writing an emacs module which would let me to write in a single file (for easy search and edit reasons), and then cut it into several modules where I mark them with =======xyz.h========= etc. I also want to use this in each repo where it automatically does this. I’ll hopefuly stop procrastinating and write the thing one day :). To end with a Game of Thrones analogy, hearing about the latest developments I sometimes feel like we editor/linux/bsd/cli users are like Wildlings beyond the wall. We live in harsher conditions, but are amazed when we see large cathedrals, castles being built inside the wall. Our life is more free but also burdensome.
- lisper 6y ago> code is scattered across many files which are barely one screen long ... one third of which is the copyright notice and license, and another third is boilerplate.