Fork me on GitHub
#membrane
<
2022-09-09
>
Ben Sless07:09:31

I want to start building a GUI application in Clojure. Its state will update both from user input and from external events (coming in over a channel) My first instinct is using membrane for it , but I would like your honest evaluation if it is the best fit platform at this time. This application will be a client to various back ends, including live data feeds. Some capabilities would be browsing available feeds. Opening feed in new tab. Posting to feed (will require text input field), etc.

phronmophobic18:09:26

Nothing about your description makes it seem like membrane would be a bad fit, but I can do my best to describe some of the tradeoffs. > Its state will update both from user input and from external events (coming in over a channel) I think this is an area where membrane really shines. Most platforms/frameworks impose a lot of structure on your application. Membrane tends to conform to whatever architecture makes sense for your application rather than the other way around. Membrane does have builtin state management support, but it's easy to swap or mix and match. I'm definitely biased, but membrane is much, much simpler (in the clojure sense) than other UI options. In my mind, the main trade-off with membrane vs. other platforms is that other platforms have a bunch of builtin, default functionality, but doing something besides the default is a pain. Membrane has less builtin functionality, but the pieces are simpler and it's easier to mix, match, rearrange, and recombine. • Do you require formatted text (italics, bold, underline, color etc)? • Do require emoji support? These aren't dealbreakers, but it is currently a weak area for membrane. Text is a pretty broad topic (eg. layout, emoji, formatting, fonts, etc, etc). Especially with the skia backend, there aren't really any fundamental limitations, but current builtin support is basic (fonts, color, bold, italic, measurement). Emoji is supported in the sense that if you use an emoji font, you will get emojis. However, some platforms (like the web) have a layered system for selecting a font based on unicode range which is usually what you want for emoji. Working with text is an area where html/css/js actually does pretty well. Text input is also pretty basic at the moment (ie. text input, copy, cut, paste, cursor, selection) which doesn't necessarily follow your OS conventions. If you're targeting the jvm+desktop, I think membrane might be a viable choice, but partly because I think the other options are painful. The safe option is to use something like Electron+cljs+your-favorite-cljs-ui-lib, but supporting clj+cljs and shoveling state back and forth introduces a ton of incidental complexity. I haven't used much swing or javafx, but my limited experience wasn't very enjoyable. Again, I'm biased, but I've enjoyed using membrane for various personal projects and tools. I'm also happy to help improve any parts of membrane that would help make your use case work.

Ben Sless18:09:35

Thank you Basic text input should be enough, at least initially. I want a jvm desktop client, no browser needed. It's almost the entire point of the exercise. Regarding the application state itself, I thought it would make sense to maintain it in datascript (queries, yay!) as an internal cache layer, and basically render the results of queries + updates. My main problem is I get confused very easily when I try to build UI stuff, and often have no clue where to start or how do design my application. Nothing about this use case is complex, besides my odd ideas regarding maintaining state and how/when queries will need to be sent to the backend. And the use experience has to be nice 😄

👍 1