I prefer server-side templates and rendering hands-down. This makes it absolutely trivial to build HTML for anything just by hitting a URL that represents it. It also makes it trivial to add caching of those fully rendered HTML blobs if desired/needed.
I prefer to keep my JS focused on interactions and behavior, not turning JSON data into UI components. I build most apps with a skeletal JS layer that knows how to grab the right item at the right URL when triggered by a user action, and what part of the page to place the returned HTML into. I find it pretty fun and challenging to see how dumb I can keep JS.
I despise the idea of building dual validation in the client and on the server. Fuck that noise. With a forms library that is tied to my models (something that exists in most mature frameworks), the server near-instantly validates and sends back HTML with errors marked if the form is invalid. Again, JS just has to know to PUT/POST the form, and display the response in the right spot. And those forms still work when you hit them by URL instead of through a fancy JS-ified UI. Makes it damn trivial to build dumb versions of an app that aren't broken and unusable. And I like the idea of being able to replace a backend that only has to keep the contract of returning HTML from an endpoint. Don't even need to modify the client-side JS that responds to user actions if I don't want to. Maybe, at worst, I update some ids and classes if I decide to modify the markup.
I've never joined the bandwagon of server-side JS and Node. Ultimately, I simply can't bring myself to want to use JS as the primary language for my work. Not to mention that JS tooling, npm, and different versions of ES is an abysmal headache that creates way too much mental overhead just to get started. It's nice to be able to pick a language that just runs on its runtime without needing to know or setup whatever the flavor-of-the-month transpiler is that lets me use classes and shit.
JSON is cool as a means of exchanging data with an API. I like that. It's predictable, standardized, and a helluva lot better than SOAP ever was. But I find working with APIs programmatically and providing UIs to humans are wholly different interaction models, and can't help but feel that we keep making presenting UIs to humans increasingly more complex than necessary. APIs provide a predictable interface for exchanging structured data. UIs are meant for interacting with that data.
No comments yet.