
Ask HN: Alternatives to MVC - perspective1
I&#x27;d like to branch out from MVC for my next webapp. What battle-tested alternatives are others using?<p>Here&#x27;s a post from 2014, but there aren&#x27;t any example code bases. https:&#x2F;&#x2F;blog.ircmaxell.com&#x2F;2014&#x2F;11&#x2F;alternatives-to-mvc.html
======
davidjnelson
You could look into functional reactive programming as in rxjs/rxjava etc
([https://medium.com/netflix-techblog/reactive-programming-
in-...](https://medium.com/netflix-techblog/reactive-programming-in-the-
netflix-api-with-rxjava-7811c3a1496a)) or command query responsibility
segregation
([https://microservices.io/patterns/data/cqrs.html](https://microservices.io/patterns/data/cqrs.html)).

------
deepaksurti
If you haven't, you can look at MVP [1] and [2].

In MVP, by rotating (or twisting) the MVC triad, one can produce an "Observer"
based framework that is easy to use and more flexible.

Some googling and you may find more literature on the same including
comparisons with MVVP.

[1] [http://www.object-
arts.com/downloads/papers/TwistingTheTriad...](http://www.object-
arts.com/downloads/papers/TwistingTheTriad.PDF)

[2]
[http://carfield.com.hk/document/software+design/MVP.pdf](http://carfield.com.hk/document/software+design/MVP.pdf)

------
xaedes
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);

------
quickthrower2
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.

~~~
tabtab
What is a "Restful feel"? I didn't think REST was a UI pattern or style.

~~~
tim333
from [https://www.codecademy.com/articles/what-is-
rest](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

~~~
tabtab
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.

------
tabtab
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)?

------
sebscholl
I'm ready this book right now, and it's great. [https://www.amazon.com/Design-
Patterns-Elements-Reusable-Obj...](https://www.amazon.com/Design-Patterns-
Elements-Reusable-Object-
Oriented/dp/0201633612/ref=mp_s_a_1_3?keywords=design+patterns&qid=1565745735&s=gateway&sprefix=design+pattern&sr=8-3)

------
arh68
One alternative: The Elm Architecture [0] is more like Model-View-Update than
MVC. Examples aplenty [1].

[0] [https://guide.elm-lang.org/architecture/](https://guide.elm-
lang.org/architecture/)

[1] [https://elm-lang.org/examples](https://elm-lang.org/examples)

------
throwaway5d097
"View oriented" like [https://www.liftweb.net/](https://www.liftweb.net/)

------
fgonzag
I'm quite fond of the Ports and Adapters / Hexagonal architecture.

------
dragonwriter
Well, MVVM is a battle tested alternative to MVC.

