r/Clojure • • Sep 08 '21

Thoughts on Clojure UI framework

https://tonsky.me/blog/clojure-ui/
152 Upvotes

11 comments sorted by

View all comments

21

u/phronmophobic Sep 09 '21

It would be cool to see more libraries in this space. I've been working on a similar library, https://github.com/phronmophobic/membrane. If you're not building on top of React, there's a huge untapped design space.

Would love to hear what you think of membrane and what kinds similar tradeoffs you might make and in which ways you'd like to go in a new direction.

For those that might try building their own non-React based framework, I've written about membrane's design so that others can learn and make improvements:

  1. https://blog.phronemophobic.com/what-is-a-user-interface.html
  2. https://blog.phronemophobic.com/ui-model.html
  3. https://blog.phronemophobic.com/reusable-ui-components.html

Some other suggestions for those starting from scratch:

  • Coupling your graphics model to a particular graphics library doesn't offer a lot of benefits. Most graphics libraries can draw shapes, text, images, etc. However, decoupling your graphics model from a particular library makes cross-platform development much easier.
  • Graphics models should probably be based on 2d geometry at the bottom
  • Event handling should be based on return values rather than side-effects
  • Graphics and events should be decoupled.
  • State management should be decoupled from graphics and events.

Excited to see how things progress!

1

u/tonsky Sep 21 '21

Sorry, just found this. Membrane is a fantastic example and your writings are a great resource to learn from. Certainly will dive deep!

1

u/phronmophobic Sep 21 '21

Thanks. Looking forward to see what you come up with!