4 ms·
I used to develop with JavaScript, and JavaScript with Backbone before we switched to ClojureScript. Backbone helped me to better structured my code but I foun
by Kototama 14y ago
I used to develop with JavaScript, and JavaScript with Backbone before we switched to ClojureScript.
Backbone helped me to better structured my code but I found it also brings its own problems. There is a quite a lot of boilerplate code and views composed of other views were for me hard to manage.
I also wrote some macros to use Backbone from Clojure but the mismatch between object/mutable and functional/immutable is too high.
Finally the approach from http://clojurescriptone.com/ http://clojurescriptone.com/ seems promising. It uses a simple yet flexible event dispatcher. Add that a templating engine and you are done.
Debugging ClojureScript within the browser is harder than normal JavaScript but it's easy nonetheless to find what generated JS functions corresponds to your ClojureScript code. If you compile in debug mode you can set a breakpoint as usual. Compiling ClojureScript adds a bit of overhead to the workflow but I compiled it continuously in the background via Emacs and forget about it, it just popups when an error occurs.
In general I found ClojureScript much cleaner than JavaScript and it's easier for me to write cleaner code with it when the data manipulation or the logic is not trivial.
- Torn 14y agoYeah, we had to write our own view nesting logic and allow this to be used within our dustjs templates. Marionette (https://github.com/marionettejs/backbone.marionette https://github.com/marionettejs/backbone.marionette) lets you do all of that stuff out of the box; I've not used it though so can't comment.