r/javascript • • Dec 19 '16

~15 years trying to make everyone separate HTML, JS & CSS. And then suddenly everything went south and we’re writing code like this.

https://twitter.com/thomasfuchs/status/810885087214637057
483 Upvotes

258 comments sorted by

View all comments

Show parent comments

14

u/CaRDiaK Dec 20 '16

TLDW; Separation of concerns is not herding code into their respective files for the sake of it, as concerns often span boundaries. My 'input' concern contains a bit of logic, bit of markup and some styling, don't make one hunt for it across multiple files.

-6

u/kethinov Dec 20 '16

Do people not know how to use grep anymore? Personally I like splitting things into multiple files because it reduces the amount of indentation. Do kids these days not find callback hell / pyramid of doom / infinite nesting to be at all problematic?

7

u/DaemonXI Dec 20 '16

What you just said has nothing to do with anything in this thread.

-1

u/kethinov Dec 20 '16

u/CaRDiaK mentioned not wanting to hunt across multiple files.

I replied directly to that concern by saying that it's debatable whether hunting across multiple files is worse than the additional nesting caused by combining the files into one.

Seems like my reply has pretty much everything to do with what I was responding to.

2

u/Retsam19 Dec 20 '16

Saying "I know grep" is a really bad argument against logical code organization. It's great that you know how to cope with disorganized code, but that doesn't meant that proper separation of concerns isn't valuable.

Plus, SoC isn't really about what files you put your code in: it's more about the logical structure of your code: what parts go together and what parts need coupling. The traditional answer was "HTML goes with HTML and JS goes with JS", but the idea of React is that it makes more sense to divide by function, not by layer.

2

u/kethinov Dec 20 '16

The result is considerably more nesting though, which I'm saying has tradeoffs.

You can disagree with that argument, but you can't disagree that it's relevant to the thread.

The whole point of the thread is to debate the merits of dividing by function vs. dividing by layer.