PSA: You wouldn't write a book and put every paragraph in a separate file, that would be confusing as fuck One Class Per File is doing exactly that, but for code. Don't do it!
-
-
Since you don't know WHY someone is reading your code, it's rather foolish to think that you know the best order for them to read it.....
-
It's actually not! Thoughtful ordering does not preclude or inhibit tooling that lets people skip around
- Još 2 druga odgovora
Novi razgovor -
-
-
Totally agree but Tools are inferior yet. I find myself struggling to navigate between classes and methods when they are the same file. Maybe it’s me just a Dino :)
- Još 4 druga odgovora
Novi razgovor -
-
-
I like one class per file, except for inner/embedded classes of course. Every class must have a unique responsibility. It's the same at file IMO. Namespaces/Packages groups classes by other concepts. Navigate between classes is a piece of cake with any good IDE.
-
You're agreeing with me and you don't know it. Every File should be a meaningful, encapsulated part of the code base - this *doesn't happen* with one class per file! You end up with dozens of files that actually Aren't That Important At All, and Aren't meaningful or standalone
- Još 4 druga odgovora
Novi razgovor -
-
-
Beautifully stated
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
One class per file is a very simple rule that you can follow 99%. I get lost in files with x classes, don‘t like it. There are plenty of reasons, all writen down, why this is best practice.
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Noticing a trend in the replies here where people who appear to support one class per file also seem to need to communicate this by being condescending assholes.
-
They sure do. Dunning-Kruger in full effect in my mentions
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.