top | item 39238527

(no title)

czechdeveloper | 2 years ago

By now, making UI with (by now not completely) SPA frameworks specifically made for that task is just better developer experience. I won't go back to pretty much html string concation via templates. Why do people keep pretending it's better in any way is lost on me.

discuss

order

zelphirkalt|2 years ago

Using a traditional templating engine is not treating HTML more as a string than React based frameworks do. Maybe even lass so, because of the separation of concerns. Traditional tenplating engines can separate part of HTML into named components without problem. Check for example Jinja2 or its clones in other languages. There is really no need to treat HTML in a plain PHP string concattenation style. There has not been for decades.

If you want something more structured data, look at sxml (see Racket or Guile). Then implement that in a library and use it in place of the default of most (all?) SPA frameworks.

tazjin|2 years ago

It's well understood that the reason people drag in these unnecessary frameworks is often because they prioritise their developer experience over the user experience, and you're just proving the point ;)

For what it's worth, the developer experience is also highly subjective.

zelphirkalt|2 years ago

I remember when NextJs could not properly watch files and rebuild when files are changed, because it has a problem with emacs backup files. It would crash and the I would have to restart the watch, defeating the whole purpose. An issue exists/ed on Github, but no real interest was there to fix it. Just to name one example of dev XP that was worse.

The need to deal with whole NPM ecosystem is another point, that significantly negatively impacten my dev XP compared to rendering plain old school templates in other ecosystems.

eggdaft|2 years ago

Yeah the backlash against SPAs doesn’t make any sense. Server side rendering is fine for documentation etc. but full applications don’t want to be simulated on a server, client-server makes complete sense.

ho_schi|2 years ago

I don’t share this position.

Webservers shall create and provide the readily HTML so browsers can render the website without JavaScript. Actually text-browsers should render it and also allow disabled persons using it without hassle.

Instead SPA (or more direct JavaScript) is used to force the browser to assemble the HTML and it is slow and waste resources. Creating website which create load on the client-site is bad because we’ve power on the server dedicated for this task - not so on client.

Looking back web-developers need something imperative and more direct than CGI, PHP or JSP. The initial backslash against JS was right. I sadly shipped JS.

When a powerful application is needed? Make a native application and use an appropriate toolkit (Gtk or QT).

account42|2 years ago

Theres about zero websites I use that I want to be "full applications". For things that should be applications I prefer native (open source) desktop programs.

joquarky|2 years ago

If you are concatenating strings of HTML, you are basically asking for an injection attack.

There are lightweight frameworks (like knockout) that keep things simple but keep you safe with bindings, without giving up control to a bigger framework.