Options for State Management in Blazor - redux

What libraries/techniques are available in Blazor for State management for webassembly (wasm).
It would be nice to know pros and cons of different approaches.

There are several options:
Redux (Fluxor)
Redux/Flux pattern has become a leader in state management in JS word; so it would make sense to adopt this best practice.
Luckily there is already a Fluxor library that does just that; and it does have the most github stars 379; although it is still a relatively new area; so it remains to be seen what ends up being the most adopted approach later on.
There is a great intro video along with source code
Official docs:
State, actions, and reducers
Effects
Redux Dev Tools
An in depth article.
Blazor-State
Blazor-State
Pros: uses MediatR for messaging
See also
Overviews of State Management Approaches
https://chrissainty.com/mobile-blazor-bindings-state-management-and-data/
https://jonhilton.net/blazor-state-management/
https://learn.microsoft.com/en-us/aspnet/core/blazor/state-management
nice but mostly messaging: https://jasonwatmore.com/post/2020/07/30/aspnet-core-blazor-webassembly-communication-between-components
keywords: passing data between blazor wasm webassembly components child parent attributes events handling

A Blazor app is a C# app on top of the .Net BCL libraries. We don’t need to emulate what the JavaScript world has created to overcome its own deficiencies. C# can cache anything you want with static members.

Related

Angular Component Library Project with NGRX?

I've used NGRX for a few projects now and generally really like it. But I'm struggling with whether or not to use it in my next project which will be to create an angular component library.
Is it recommended to use ngrx in angular library project types? How would you setup the root state vs the feature state? Would my library project's main module attach to the ngrx root store? If so then if my library is used in a parent app that is also using ngrx would the root store's collide?
Update (More Context):
The majority of the components in the library will be typical forms of data type of stuff. For example providing components to search, update, create and delete things across multiple applications. We're packaging them up as a component library (and angular elements library) because they will need to be used in multiple web applications until those web applications converge into one new super web application (time line for convergence is 1+ year down the road). The other integration path we were looking at was loading an iframe in all these client apps.
The components themselves will connect to an API layer to do all the data I/O. Components may need to share parts of state across components.
This is hard to answer without having the full context.
If we're speaking about a "pure" component library, I would rather not pull in any state management libraries. If the component needs some state, it should manage its state on its own.
Components using this library can always be in control of the communication with the store.

ASP.NET Core 2.0 Razor vs Angular/React/etc

I am beginning to develop an Enterprise level web application. The application will have many separate web pages but two of those pages being more focused and very heavy - heavy as in a lot of user interaction, modals that display mass data, websocket connections, chat, etc.
I have been assigned to Chief Architect on the project, so I am doing some research into the latest web frameworks. For the back end, we have done some testing and have decided to go with the Azure SQL platform. So far, I am liking the improvements that have been made, and are being made, to ASP.NET with Core 2.0. Specifically the Razor engine, over previous versions of ASP.NET MVC.
I wanted to get some expert opinions on the "new" Razor vs. Angular/React and the like. I'm particularly more concerned with performance. How does Core 2.0 Razor hold up to client side rendering frameworks? Are the differences negligible? Our app is targeting a potential 1,000,000 users (roughly 100,000 concurrent).
We ended up going with an Angular front-end and an ASP.NET Core API backend, using Azure SQL. We tested Core Razor and, although better than legacy Razor, Angular was much faster for us in the end. As far as user experience goes, Angular (or React) is far superior in terms of performance. The model-binding aspects of Angular we found to be a gigantic advantage of server-side rendering. Using Razor(or server side rendering in general) does, however, lend itself to better overall integrity as far as data goes and it makes for a better transition of data from front-end to back-end. There is a true disconnect between a front-end framework and an API. All data that is passed to the server has to be cast into typed objects - this means you have to manage two separate POCO model sets. This can cause issues if server objects and front-end objects do not align. At the moment, Entity Framework Core is not very matured so we have issues with updating objects, querying objects, including child objects, etc.
Overall, this setup has worked out great for us so far! I would imagine React would be a similar replacement to Angular if you're more comfortable with it. I had to learn Angular, which was a very easy transition, and I love it now!
By using Angular/React with API on the server-side:
you eliminate the process of generating HTML on server-side and you save CPU
API produces a small payload (JSON) and Razor (HTML) of course would be much larger in size, the constant full page reloads, and postback round trip, so API and SPA save bandwidth
API and SPA could have different versioning, scaling and deployment scenarios
By using API you can support mobile app too and if you start with Razor you may need API in future
But by using Angular/React, you should be worried about clients:
client must enable javascript
client must have modern browsers
client must have enough powerful hardware
SEO
I don't have benchmarks. But, I have several projects running JQuery, Razor, .NET MVC (C#), AJAX. Not to the scale you're tackling.
Advice.. Be sure to think things through and follow best practices. To keep things maintainable be sure to break controllers, views, model into smaller and meaningful groups. When I started, I made the mistake of putting everything into one Home controller, and a ton of views in the shared folder. Was fine at first but when feature creep began, it became a mess and difficult to go back and redesign.
I also use Linq2SQL. I made the mistake of creating models for everything and then realized I could just return the result set from my queries as a model. duh.
If you go .NET MVC and are concerned about performance, these are the things I ran into:
DON'T return partial views that create large blocks of HTML! Be sure to minimize everything. Get rid of all the white space. Use smaller ID names. Take the time to create html that is as light as possible. Return JSON and have the client do some of the work.
Be careful on how you develop your CSS. Don't use a bunch of inline styles, take the time to incorporate into CSS files that you can later minimize.
Same goes for your client side JS. It's tempting to put the JS inside partial views. Keep things organized.
Rendering on IE is horrible. Especially if there are lots of images. Be sure to compress images as much as possible, without losing quality of course.
React vs Angular
Basic Security on client side environment in Angular while React security not provide.
Angular execution slow while React execution is fast due to virtual dom.
Angular code is not 100% customize while react code is 100% customize.
Default Typescript in Angular while React use Javascript and Typescript Both. This is the main reason many developer like React because developers like JavaScript

JavaFX, DataFX and server-side code

I'm looking at enterprise JavaFX, and how to integrate JavaFX with server-side code. In the last few weeks I've done a certain amount of research in DataFX and Open Dolphin, and downloaded some videos, as well as looking at a couple of other frameworks. For example I've looked at the video on DataFX at:
https://www.youtube.com/watch?v=EN4fo6x0DcQ
However, although this video and others I've looked at explain how to set up a client application that connects with a server, I've found very little information on how to put together some server-side code that the client can connect to. Sure, one could use JAX-RS, but why re-invent the wheel? In the first instance I would like to put together some really simple server-side code that some test client-side code can connect to using DataFX or one of the other frameworks. The aim eventually is to get a client using JavaFX to communicate with a server.
My second question is that of the various frameworks available, is DataFX the best to use for a simple application?
I have experience with a Glassfish server hosting a JSF application, and it may be useful to have such a server hosting a JSF application communicating with a browser as well as communicating with a client JavaFX, as that way I can test out that the communication with the JavaFX application.
The latter is a bit of an aside, and my main questions are where can I get information on server-side programming for this, and the best frameworks to use?
Many thanks in advance.
If you are able to manage yourself the client-server communication you can pick any JavaFX Application Framework listed there:
https://github.com/mhrimaz/AwesomeJavaFX
Any of them allows to separate UI code from communication code.
As I'm author of JRebirth, I can advice you to create some RemoteService (extends Service and providing JAX-RS facilities or whatever) to perform this job.
If you search an all-in-one library managing client AND server side, DataFX + OpenDolphin is probably the most advanced one.
I'm the author of DataFX & Dolphin Platform (https://github.com/canoo/dolphin-platform). Both are valid frameworks that fill fit to your needs. Maybe a combination of both - Dolphin Platform as remoting layer between client and server and DataFX to define the routing and mvc based views on the client.
Some days ago I copied all the DataFX sources to GitHub (https://github.com/guigarage/DataFX) and currently trying to create a new version based on the modules that are maintained by me. Maybe I will extract the MVC related stuff and create a new framework based in it, we will see. What I currently can say is that I plan to work on it the next month next to the Dolphin Platform since I think a combination of both will be a good fit.
I would use this combination today to create applications but yeah, I'm the main developer of both frameworks so the choice is quite easy for me ;)
As you mentioned JSF I think that Dolphin Platform is a perfect match for you since one idea of the framework is to have a modern successor for JSF that can be used to create desktop & web based applications but provide managed controllers on the server. We provide a cool maven based jumpstart (Maven archetype) that will give you a quick introduction and a runnable client / server application with a desktop and web client in 2 minutes: https://canoo.github.io/dolphin-platform/#_dolphin_platform_jumpstart

MeteorJS Alternatives: Latency Compensation Frameworks and Libraries?

Effort:
I am building a word game based on a chat web-client where I need to make a server call on input chat text to validate it before broadcasting on the chat.
I am aware of Meteor providing latency compensation out of the box. But given its still in "early preview" makes me seek other alternatives.
What I tried:
Unfortunately my web search for "latency compensation framework library" doesn't yield anything other than Meteor (including non-personalized results).
Question: Are there any other alternatives that provide latency compensation -or- can make the job easier? I am hoping other developers might have encountered something useful/relevant.
Although Meteor is in 'early preview', its code is very close production ready and a lot of startups and other early adopters are using it for production-level code. You aren't going to find anything that gives you wings like Meteor because no such alternative exists.
As a hardcore Meteor convert and someone who's used many other frameworks, I recommend you to just try Meteor out. As they say, it only takes a weekend for you to build an app in Meteor and decide whether it's right for you.
Having said that, I will attempt to answer the question and list the distant-second alternatives to Meteor that you probably won't want to use:
Derby
Sails
What you're seeing right now in the various real-time full-stack Javascript web frameworks is the future of Web development, cutting down dozens of people and thousands of man-hours of work needed to develop a software project. There are some fast boats sailing that are leaving server-side rendering behind, and you should probably just get in one of them and get going.
RethinkDB uses term 'latency compensation'.
I've also tried to gather per-feature alternatives to Meteor
Meteor is a really cool framework. you can build the complex data driven application very easily using meteor.
But, this framework currently supports only the MongoDB as back-end database.
I have recently created full stack framework called Nooljs which is similar to the Meteor. Now I have open sourced it. It support all the database connections including MySql, ms-sql, and MongoDB. The complex data driven application can be created easily using this framework.
This has been developed using well known existing framework such as Angularjs, Node, express-js, and socket-io.
Easy to build complex data driven JavaScript applications with minimum coding.
Support multiple data connections suck as Ms-sql, MySQL, PostgreSQL, and Mondodb.
Real time framework build top of Express-js and Socket-io
The client side is powered by the Angularjs.
The layout can be build using the Angularjs tags and elements.
Modularized layout to simplify the complex web pages.
Can be mixed both Express-js and Socket-io

Whats the best practices to let flash files communicate with my website?

I am working on a website and this website contains games and this games will need to submit score to the website so the website will handle saving the user game score in the database.
So i am asking about the standards and common techniques to do this communications between the website and the flash games, is it better to let the flash files call javascript functions or call server side code? i have no idea how this can be done
Note: i can ask the flash games creator to edit the flash files to call some functions.
Also may be 'not sure yet' i will need to send from the server to the flash some variables.
It would be better for you if you create some javascript api that the game creators can hook into. Then it is entirely up to you what you do with it: ajax calls to webservices springs to mind.
This would protect you from having to learn Flex or Action script and if you can get the agreement of the game developers on the api, then you have abstracted this interface and your implementation in the browser will be de-coupled from what happens in Flash.
Well, the way I'm used to it, is that firstly, you design an API for the service the game developers should use. Obviously, you have to actually implement the service. :)
The next step is to provide an SDK, that further encapsulates the API and makes working with it easy, bridging the semantic gap between the API and the client, and sparing the developers the dull work of marshalling calls and parsing return values.
You can provide the SDK for use as a runtime shared library, so that you can provide bug-fixes and other interal changes without requiring recompiles and updates.
The reason, why I cannot really agree with Daniel is, that I don't really see a benefit in introducing an intermediary layer. It is just one more source of errors and security issues. From my experience, the most dramatical changes I know to APIs is deprecation of calls, change of call signatures or structure of returned data. Since you're writing this from scratch, it is very likely to happen.
In conclusion, the best practices for me are:
a well designed API
documentation
an SDK
developer support
greetz
back2dos

Resources