5 ms·
Electric Y Combinator – Electric Clojure
- thih9 3y agoImpressive! Also, I enjoyed the demo, especially interactivity and source code. One question: what are the front end options with Electric? E.g. can I use electric together with some front end framework (React/jQuery/anything)? Or should I stick to writing front end components using electric?
- koito17 3y agoYou can use React with Electric if you want, though it is not really necessary because Electric already has fine-grained reactivity and can save you from the usual headaches with server-side React. With that said, people have used Reagent in Electric before. In fact, the Electric Clojure tutorial has a tutorial on Reagent interop[1]. [1] https://electric-examples-app.fly.dev/user.demo-reagent-interop!%52eagent%49nterop https://electric-examples-app.fly.dev/user.demo-reagent-inte...
- ano88888 3y agoCompletely new to Clojurescript or electric DSL so this might be a stupid question (will learn more later). As someone who is not a designer, i tend to pick a framework (eg react) that has many good looking design libraries so that i don't need to style each component. I understand that the demo & examples are meant to show the power and functionalities of this good functional langauge. But the examples are unstyled, plain looking, ugly and seem like will take a lot of work to look good. Since i am not a designer, i just want to plug and play a good looking UI library and focus on business logic. hope i am making sense here.
- dustingetz 3y agowe have styled examples including TodoMVC: https://electric-demo.fly.dev/(user.demo-todomvc!TodoMVC) https://electric-demo.fly.dev/(user.demo-todomvc!TodoMVC) -- note it is full-stack unlike other TodoMVC impls which are frontend only we use tailwind in IRL projects
- ano88888 3y agoIt would be great if you have something like this for mobile apps. How will it work if your product has both web and mobile apps, do you have a create a separate backend for the mobile apps?
- deleted 3y ago[deleted]
- Capricorn2481 3y agoIs this production ready? From what I understand, this allows people to arbitrarily decide which portions of their DOM get's run in the client or in the server? Essentially allowing us to make SSR pages with client side code sprinkled in, wherever we want. If so, this seems like a really big deal for Clojure world.
- koito17 3y ago> Is this production ready? It's been worked on for several years AFAICT. It's only very recently that it got a public release, but it was built specifically for use in Hyperfiddle, the company of Dustin Getz (also the same person who developed Electric Clojure). I am not sure what is a good way to determine whether something is production ready, but I know its developers have been dogfooding it for a while now. The only real problem I see is lack of other companies adopting it leading to nobody else wanting to try adopting it. The other big problem is that it's hard selling people Clojure either because it is a niche language or the parentheses scares people away.* * Note I use Clojure in my day job. I do not think either of these two points are a valid excuse to not use Clojure, but they are the most common excuses I see.
- dustingetz 3y agoelectric has been a team effort, developed primarily by Geoffrey, Peter and especially Leo of https://github.com/leonoel/missionary https://github.com/leonoel/missionary who is the lead developer. the thing predating Electric is in prod at a series B startup, a series A startup is going live with a prod support app in a few weeks, and a seed stage startup is planning a rewrite of a consumer facing productivity tool onto electric after serious evaluation. Plus many serious POCs i’ve seen maybe 2-3 dozen repos this summer. (we only see them when they have a question)
- dustingetz 3y agonot SSR, all rendering is client-side, it’s frontend/backend state sync that Electric solves
- 3y ago
- yayitswei 3y agoIn case anyone is reading the comments before the article, Y Combinator is referring to the Fixed Point Combinator (https://en.wikipedia.org/wiki/Fixed-point_combinator https://en.wikipedia.org/wiki/Fixed-point_combinator), not the startup accelerator.
- sesm 3y agoOne big advantage of React over templating languages is ability to use regular JS functions for loops and conditions. What would happen if regular `map` is used instead of `e/for` in this example: https://electric.hyperfiddle.net/user.demo-chat!Chat https://electric.hyperfiddle.net/user.demo-chat!Chat ?
- dustingetz 3y agoclojure.core/map is not incremental so you’d lose the performance benefit of reactivity at that call. Note React is not fine grain reactive and will over-compute loops; electric does not have that problem. also, e/for is just reactive map, we chose the for-comprehension syntax over lambda syntax because it lays out your UI code properly without making you feel like you’re programming with collections but it’s just sugar over incremental map. We could have shadowed clojure.core/map with reactive map, which would imply similarly shadowing clojure lambda with electric lambda, but we also highly value clojure/script interoperability, so anything we change in a way that isn’t 99% backwards compatible needs to get a new name. ergo, e/for. also note it’s really e/for-by (and e/map-by) because, like React, you need an extra “react key” parameter (they put it in a different place but the net effect is the same).
- sesm 3y agoThanks for your explanation! Making things explicit and not shadowing `map` seems like a good thing to me.
- raldi 3y agoThat’s not the Fibonacci sequence; that’s the factorial sequence.
- gorjusborg 3y agoThat's embarassing.
- ano88888 3y agoCompletely new to Clojurescript or electric DSL so this might be a stupid question (will learn more later).It would be great if you have something like this for mobile apps. How will it work if your product has both web and mobile apps, do you have a create a separate backend for the mobile apps?
- dustingetz 3y agoI've seen someone using a mobile webview with Electric, in this case its up to you if you share mobile and web backends or not. Electric can't tell the difference. Native mobile client is possible but not a priority (ClojureDart might be the best vector?)