June 12, 05:23 AM
Let me start by saying that I am a back-end developer. I do have some experience with front-end technologies, but I can't say that I am capable of a full-stack dev session. With that being said, let me rant a bit.
I find all the JS UI frameworks confusing. There are so many of them, each has its own syntax and structure, many components, and doesn't use "traditional" JS/TS, but many placeholders that get "replaced" later on. I reached this conclusion recently when I started a new project (with a new company) and the UI part was done purely in Angular and the UI communicated with the BE using REST calls. The project had less than a month since it started, so I wasn't quite from the start so I could not impose my view :D
This brings me to my next rant. The UI does soo many calls to the backend all the time. The project has a complex data structure so there are many back-and-forth messages from UI to BE to get certain data elements, save them, updated them, and so on. At one point, for one screen, I counted almost 60 calls from the UI just to populate the needed data.
Let the backend do the job I've been using template engines for as long as I can remember. It offers so many advantages (at least for me) and I honestly can't see a reason why NOT to use one. FTL templates are well integrated with most BE Java frameworks (cough Spring cough) and it gives BE control over the data that is being shown and returned.
Need to show a certain page, let the BE do all the DB queries, filtering and only display the resulting data in one go. One call to the BE to get everything you need. Also, the risk of accidentally returning MORE data than needed is reduced, since everything that is returned is displayed on-screen (with a few exceptions). Instead, if UI communicates with the BE using REST calls only, you get a complex JSON structure back but maybe only a small portion is needed.
Back-end guys can work on the UI as well when a template engine is used. Let the FE team deal with actual styling, element positioning, design... you know, the actual template. The UI should not do business logic, so there is less work for them. You would say that there is more work for BE, but that is not totally true since a good back-end always validates data received, so we are already doing most of the work anyway.
Next, there is the security component. If only REST calls with JSON IN/OUT is done by the FE, you need to validate the request origin, maybe keep an updated table with all FE servers (in case of a distributed system with many instances), use a JWT maybe... all on top of the normal session-based validations. Just using a CSRF token becomes harder when the FE is so isolated from the BE.
I am not saying that all the problems go away when using a template engine that is controlled by the BE. There still needs to be a lot of work on the UI side and you can't truly make "intelligent" FE that actually do (well) some of the business logic.
Also, I find it REALLY HARD to find a modern UI framework that works well with this. I've been using Bootstrap, but most others (like Vue, React, Angular and Flutter) don't work with a backend-driven template engine. If you do know any good and modern ones, please let me know cause I am really struggling to find something.
So what is your take on this? I know I may get a lot of hate since there are soo many FE devs focused on react/angular, but I am sure that any BE dev feels, at least partially, what I feel.
Do you use or know any UI framework that works well with FTL? I really want to stop using jQuery as much as possible for my JS needs and maybe switch Bootstrap as well with something better.
June 16, 05:42 AM
Really cool discussion!
I'm not really a frontend dev and that's why I like the TALL stack. As Livewire is a fullstack framework makes it quite easy for solopreneurs to get projects off the ground without much effort.
June 16, 07:47 AM
I am a Java Developer, so I don't use JS except for front-end stuff. But my concern/question still stands. What benefits does it offer to have the UI so decoupled from the BE?
June 16, 11:28 AM
Main benefits that I could think of are:
June 17, 11:12 PM
I agree with your answer. I see the same benefits and it sorta baffles me as to why frameworks like React and Angular that are so decoupled from the BE managed to get so much traction, and the ONLY reason I can find is that it allows people that are not that good at programming to code something working. You don't need to focus on optimizations, no need to learn algorithms. Just "beautify" the JSON received with good graphics (which I do agree that requires skill) and use pre-defined components that you mix-and-match.