Ask HN: Alternatives to MVC

25 points by perspective1 ↗ HN
I'd like to branch out from MVC for my next webapp. What battle-tested alternatives are others using?

Here's a post from 2014, but there aren't any example code bases. https://blog.ircmaxell.com/2014/11/alternatives-to-mvc.html

16 comments

[ 5.8 ms ] story [ 17.6 ms ] thread
It depends on why. Is it for learning purposes, or some other reason? Old school (but battle tested, not great patterns for learning though):

* One file (script) per route e.g. classic vanilla PHP.

* ASP.NET web forms - tries to make the web like a drag and drop windows forms application. Very nice for basic websites but doesn't scale to well if there are a lot of nested controls. Has this horrible concept called 'viewstate' where you send state about your controls in a hidden form field and post it back. This makes server side "on change" events possible for client side actions. It's horrible because Viewstate size grows quickly for complex forms, and it doesn't feel very web-like or Restful.

If you want to create a SPA, then React/Redux and Elm offer interesting patterns, but your server would still need to send data, and I can't think of anything better than an MC (no V!) type of framework for this.

What is a "Restful feel"? I didn't think REST was a UI pattern or style.
from https://www.codecademy.com/articles/what-is-rest

>SEPARATION OF CLIENT AND SERVER

>In the REST architectural style, the implementation of the client and the implementation of the server can be done independently without each knowing about the other. This means that the code on the client side can be changed at any time without affecting the operation of the server, and the code on the server side can be changed without affecting the operation of the client.

which is kind of different from having server side "on change" events

Still this describes an "under the hood" implementation technique. It doesn't describe a UI method/technique/style in terms of what the end user sees. The end user's perspective is the key to my question. If that wasn't clear, I apologize.
Stateless is what I imagine REST to feel like. You do everything with just an API key or token. There's no need to keep trading credentials with the server.
A ton of web frameworks are trying to reinvent WebForms using WebSockets e.g. Phoenix LiveView, the new Blazor components in ASP.NET CORE that uses WebAssembly alongside WebSockets to create a unified stack. Unfortunately the whole web builder concept is no longer popular other than for generic sites, those areas are dominated by companies like Webflow, Weebly, SquareSpace, Pinegrow etc.
(comment deleted)
Microsoft has something called Razor Pages that is sort of a hybrid between MVC and Web Forms. It may be a better fit for smaller projects, but is still fairly new.

Are you mostly doing CRUD (data-centric), or a more document-centric (CMS-like)?

I'm quite fond of the Ports and Adapters / Hexagonal architecture.
Immediate mode gui - short imgui. For example the library "Dear imgui".

Basically you write imperative paint functions like this example:

  ImGui::Text("Hello, world %d", 123);
  if (ImGui::Button("Save"))
  {
      // do stuff
  }
  ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
  ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
Well, MVVM is a battle tested alternative to MVC.