Live data from Hacker News

Bringing functional to the frontend – Clojure and ClojureScript for the web

blog.getprismatic.com

21–30 of 64 posts

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#21
post #2

Author here. Happy to answer any questions or comments.

What ClojureScript libraries are you using?

What other "regular" JS framework/libs do you use with ClojureScript (thinking about jQuery, Backbone, angular and the likes)?

About dommy, what made you choose DOM vs String generation (knowing the later could be faster in some situations/setups)?

And the last one, did you consider EDN? I'd guess you choose json for obvious performance reasons.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#22
post #13

"The above is valid Clojure code, not another language whose syntax you have to learn or separate compiler to use." Even though this is a fair point, the comparison between the Jade solution and the Clojure one is invalid. Jade was conceived as a whitespace-significant language. Its biggest benefit over plain HTML (or HTML-based template engines like Moustache) is the usage of indentation to determine hierarchies. Th…

It is not clear that whitespace sensitivity has ever been a good idea in any language. In jade, it is often just encourages the antipattern of hardcoded hierarchy and throwaway templates rather than reusable abstraction. We like actual abstraction more than trivial syntactic suger.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#23

I really love Clojure, but it still feels a bit heavy-weight for anything but numerical computation. However, I'd ignore that if the performance gains were significant. What are the performance advantages of ClojureScript server-side templating compared to client-side Javascript templating? The vogue style these days seems to be a one-page app where the clicks take barely any time, because the jQuery/Zeppo/Underscore…

"I really love Clojure, but it still feels a bit heavy-weight for anything but numerical computation." That is really weird. If there's one area where Clojure feels a bit strange to me it is numerical computation. I haven't fully looked into it yet but there's the whole underlying Java idiosynchrasies issue : for example where you need to wrap inside unchecked-int to dodge overflow issue or the fact that you need to…

Actually, we do our numerical work in clojure too and make heavy use of mutable java data structures - and it's a joy to program in Clojure for these tasks.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#24
post #19

We use ClojureScript (and Clojure) at http://economi.co and I'm really enjoying it. Maybe one of the most difficult things coming into it is trying to relate it to something like BackBone. However generally speaking in Clojure the culture is more about libraries than frameworks. C2 http://keminglabs.com/c2/ which on the outset looks just like a ClojureScript version of d3 is actually a great library to use instead of…

Don't worry about how anything compares to frameworks, because they don't matter anymore.

We think traditional frontend frameworks - whether of the rails/django variety or the backbone variety, are generally rubbish in a nearly infinite number of ways. It's a style of programming based on wrapping weak mutation oriented idioms behind monolithic APIs and design patterns. We think default functional style and fine grained composability is the future, and mutation + oo design patterns + frameworks is the past.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#25
post #21
post #2

Author here. Happy to answer any questions or comments.

What ClojureScript libraries are you using? What other "regular" JS framework/libs do you use with ClojureScript (thinking about jQuery, Backbone, angular and the likes)? About dommy, what made you choose DOM vs String generation (knowing the later could be faster in some situations/setups)? And the last one, did you consider EDN? I'd guess you choose json for obvious performance reasons.

Frankly at the moment, we're not using any external clojurescript libraries; we've tried many, but none quite meet our needs or the style we really like. We're internally phasing out jQuery selectors in favor of some code that we'll be releasing once we know it's battle-hardened and ready.

We don't use an MVC or components type framework, but ideas about how to setup those abstractions are percolating.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#26
If you're interested in learning more about Clojure and ClojureScript, check out the upcoming Clojure/West conference in Portland, OR March 18-20th (http://clojurewest.org/schedule), including a keynote from Rich Hickey, creator of Clojure. There is also a 1 day training class the day before on ClojureScript if you want the deep dive (http://clojurewest.org/training). Register here: http://regonline.com/clojurewest2013

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#27
post #25
post #21

Earlier quoted context omitted.

What ClojureScript libraries are you using? What other "regular" JS framework/libs do you use with ClojureScript (thinking about jQuery, Backbone, angular and the likes)? About dommy, what made you choose DOM vs String generation (knowing the later could be faster in some situations/setups)? And the last one, did you consider EDN? I'd guess you choose json for obvious performance reasons.

Frankly at the moment, we're not using any external clojurescript libraries; we've tried many, but none quite meet our needs or the style we really like. We're internally phasing out jQuery selectors in favor of some code that we'll be releasing once we know it's battle-hardened and ready. We don't use an MVC or components type framework, but ideas about how to setup those abstractions are percolating.

I added two more questions while you where writing this reply probably.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#28
post #20
post #17

Earlier quoted context omitted.

The nice thing about dommy (github.com/prismatic/dommy) is that emacs doesn't need to be changed at all to use it. It's just clojure and all the highlighting and the emacs major mode work. Also out of the box, you get a repl to live test and evaluate template functions and data structure. It would only take a few lines of emacs lisp to take a string from the repl and pipe it through XHTML validation.

In terms of performance, wouldn't it be far faster to use strings and turn those into document fragments or setting innerHTML? I've been looking at ways to make crate much faster and it seems that would be the fastest solution by far.

That's the approach Hiccups took, it goes as far as generating most of the html at compile time as well. I didn't run benchmarks but I would guess it is faster than crate in some situations (huge fragments, older browsers etc).

Another plus is nodejs compatibilty (if you care about that, but I guess you might :)).

https://github.com/teropa/hiccups

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#29
post #2

Author here. Happy to answer any questions or comments.

I've been using Clojure for a while now. Do you have any particular recommendations for resources for getting started with ClojureScript? I tried a while back and got really confused.

Re: Bringing functional to the frontend – Clojure and ClojureScript for the web

#30
post #29
post #2

Author here. Happy to answer any questions or comments.

I've been using Clojure for a while now. Do you have any particular recommendations for resources for getting started with ClojureScript? I tried a while back and got really confused.

I haven't used it but here's a 10-part mega tutorial on modern Clojurescript: https://github.com/magomimmo/modern-cljs/
Post reply on HN