Thoughts about Single Page Applications

I like the quick rendering of simple pages with elixir templates. But that’s the only aspect that I like. I do not like to see elixircode and html mixed. I don’t want a server-side mvc. I see it as obsolete technology and I’m not alone. See all discussions on internet. I want separation of concerns.

"Well done architecture has clearly defined separation of concerns (SoS). In most cases minimal high level configuration is:

  • Data storage

  • Services

  • API

  • Presentation
    Each of those layers should have only minimal knowledge of the one above. Services need to know where to store data, API needs to know what services to call and the presentation layer can communicate with the rest only through the API. Important thing to note here is that knowledge about layers below should be non-existent. For example API should not know who or what will consume it. It should have no knowledge of the presentation layer. A lot more should be said for each of those layers and the situation in the “real world” is much more complicated than this. However, for the rest of the article the important takeaway is that the presentation layer communicates with the server through the API which, in turn, does not know anything about the “world outside”. This separation is becoming more important with ever-increasing types of machines and devices (laptop, mobile, tablet, desktop). Back-end should only provide business logic and data." (see https://technologyconversations.com/2014/07/10/server-vs-client-side-rendering-angularjs-vs-server-side-mvc/
    disclaimer: I don’t like angularjs).

    I want the ui to be rendered on the client, and traffic with the server minimal. The server has no knowledge of the ui - it could even be a desktop application - except some config in the database. The ui config I would generate in a json (with a screenbuilder you could maintain the json frame, I mean the json with some parts that can be replaced runtime) on the server, when needed. Including validations and language-dependent things like labels. Validations can be built with a simple rules engine that you build yourself. I did it myself. The rules-editor can be built in such a way that even a user could maintain the rules. These rules you persist in a database and you put them in a dataset (a map) on the server for quick access. You use the rules when you generate your ui json and you use them for validations on the server. The data that have to be validated could come from f.e. a webservice also. This way you do not have to write your validations twice + you have made them dynamic (no code to be delivered / compiled) etc. Lots of MDD again, and lots of work to get it right, but when you have this you have something neat.

10 Likes