I am interested to hear your opinion/criticism of a client application I am writing using webix using a specific setup.
Central to the client application is a message bus (postaljs). The message bus is used to decouple senders and receivers. A sender can publish a message on a channel with a specific topic, but is unaware of the receivers of that message. A receiver can subscribe to a specific channel and listen to a topic that contains the message data.
Code is organized in modules. The only way for a module to communicate to another module is through the message bus. In a way modules are thus a bit like actors. They are completely self contained.
Currently I have a request module that passes requests on to a server and reports back the result, through the message bus.
There are controller modules that orchestrate messages coming from views, and server side to modules and other views.
Model modules are only used when tracking of original and current state is required. Otherwise state data is directly passed on to the views (i.e. the views can choose to listen to a topic on a specific channel and use the state data).
The view modules contain the view config objects to create the webix views and wires event handling to publishing messages to the message bus. Likewise handlers are subscribed to the message bus to update the view.
The specific benefits of this setup are:
- I can describe the complete application logic in a single message object
- I can intercept messages and implement cross sectional concerns (like logging or recording user activity)
- I can test and change the behavior on the fly by publishing messages or creating additional subscriptions
The code for this application can be found at:
GitHub - halcwb/GenPDMS: Generic Patient Data Management System.
Look at the latest commits (master is far behind) in the client folder.