Re:Virtual DOM is pure overhead (2018)
by JMTQp8lwXL on Sunday May 19, 2019 @02:11AM
(#19951742)
I've never understood how people view the separation of template, styles, and business logic into separate files as simpler. Now, to work on a single component, I need to open three files in my editor, instead of one.
[ Parent
| on HN ]
The "separate files" argument is a red herring. It is really about separate "mindsets" or "modes of thinking".
In effect, JavaScript logic tends to be procedural/imperative, while templates allow declarative semantics, and styles are nearly a 2.5D constraint language. "Separation of concerns" here means only having to think in a particular mode, rather than blending all of those modes of thought into a single eyespan.
Notably, Vue allows for single-file components, while preserving the familiar and intentionally designed separation of declarative (HTML), imperative (JavaScript), and aesthetic (CSS) code.
Re:Virtual DOM is pure overhead (2018)
by JMTQp8lwXL on Monday May 20, 2019 @06:44PM
(#19966033)
I don't see how separate files forces you to think differently. It might aid in that effort, but it likely doesn't force it.
It is an over reaction to bad PHP.
Bad PHP pages mixes all kinds of shit together. This leads to the thought that to do it 'good' everything needs to be seperated.
It's a wrong thought but I see how people got there.
In vue (or atleast the way the majority of people use vue), each component is separated into a .vue file. That component's template, style and business logic is all encapsulated in that one file. A basic .vue file starts out with <template></template><style></style><script></script>. It keeps everything nice and simple, in my opinion. Each different "mode of thinking" is separated out, but still all together in one file.