Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To the entire ClojureScript team: thank you so much for all the great work that you are putting into ClojureScript!

Without ClojureScript and Clojure, I would not have been able to build and maintain my SaaS app as a solo founder. The incidental complexity would have crushed me. Using a single language to write code, with model (domain) code effortlessly and fluidly shared or moved between "server-side" and "client-side" is a game-changer.

While I don't care that much about NPM, I am extremely happy with the progress that ClojureScript is making. Thank you!



i feel you, jwr. at my previous startup i've developed everything with clojurescript. our dashboard, our browser plugin, our react native app was all cljs except for the api which i built with django.

thanks to clojurescript, i was able to build all these tools so fast and clean, we had a lot of time to work on the business itself. we failed to find a product market fit though.

to every new founder out there who always wanted to try clojurescript, if you are going to work on a client application and love react, i cannot stress enough how easy and fast it is to develop with clojurescript and re-frame.


How up-to-date is clojurescript+react-native workflow?

I checked Re-natal as tool to manage build/debug workflow with clojurescript+react-native

https://github.com/drapanjanas/re-natal

But re-natal supports up to React native 0.59, which is quite far back, in the RN-release-years time units.

Now React-native is 0.62.


You can also check out shadow-cljs which has great support for React Native development. I've been able to easily keep my project up to date with the latest React Native versions. Plus with shadow-cljs you also get access to all of npm in a very straight forward way.


i'm seconding this. not only react native version that re-natal supports is old but also the re-frame & reagent versions it supports are pretty old. shadow-cljs is really a good solution and you can pick it up for react-native projects too.


If you want to use this new Clojurescript workflow with React Native, check out Krell: https://github.com/vouch-opensource/krell


I like reading these kind of stories.

I'm trying to learn more about Clojure / CLJS for web development specifically, but there are so many different tools to pick from and as a beginner it can be hard to know where to start.

And then I'm also reading about Phoenix (Elixir) and how that's better for web dev.

If you don't mind - can you tell a bit more about your Clojure story, when you started using it and your setup?

Or maybe you have a blog, where you wrote about this already?

I'm not an experienced programmer, hence the naive questions.


The Clojure way of doing things is mostly about composing different libraries for your needs. You will have a lot of small tools to work with, and comparing to Phoenix, doing even the easy things take more effort to write code. Phoenix gives you a full framework, bells whistles and all, but you have to work within the constraint of the framework.

If you are an inexperienced programmer, you might want to just stick to Rails or Django, tooling and standard are easier to learn from those frameworks, and their shortcoming aren't visible to you anyways.

If you just want to learn programming for fun, or at the start of your path trying to be the best programmer as you can be, Clojure is a valid option, but there will be a lot of head banging around the code.

Tldr; clojure = more exotic, weird but great features, you should be comfortable rolling things on your own, elixir/phoenix = more exotic rails, stick to rails if you just want to make a website.


RE: start of your path trying to be the best programmer as you can be

Thanks. Nicely put - that sums it up.

Back in the day - over 10 years ago - I was a hybrid designer who also coded up his own design (JS, Actionscript, PHP) but then focused more on design & product consulting. I want to build stuff again and I want to learn this craft properly and hence why I'm attracted to both Clojure and Erlang / Elixir.

I think it's important to choose good (virtual) mentors and Rich Hickey / the wider Clojure community and Joe Armstrong and the Erlang / Elixir community seem to be great communities with smart, thoughtful and considered people.


Clojure/Script is more geared towards experienced developers who want the power to do whatever they want, in a conscise, expressive and customized way. They value flexibility, and immediacy, and like to know all the ins/out of their tools.

Elixir is a version of Clojure adapted more towards the Ruby model of making things easier for developers, giving people more focus, less choices, emphasising best practices, and overall offering something more familiar looking to most. It's complemented by Phoenix, which has similar goals, it is focused, directed, gives people a clear path forward.

They're both capable language, but you can see they have different focus and are geared towards people looking for different things.

So it depends what you're interested in:

If you like to do things from "first principles", meaning, you want to understand starting from birth and grow to adulthood, then Clojure/Script is for you.

If you prefer to do things "on the surface", meaning, you want to just get going with a project, see something get build fast, before you understand exactly how it all works, i.e., you want to start from adulthood, and slowly (or never) make your way back to the birth, then Elixir/Phoenix is for you.


I don't think your description of Elixir and Phoenix is correct: Elixir is a language targeting the erlang virtual-machine. it does not seem clojure-inspired. Phoenix is a web development framework written in Elixir.


From the creator of Elixir (Jose Valim) himself:

> I’ve learned a lot also from Clojure because, at the time I was thinking about Elixir, Clojure was already around. I like to say it’s one of the top three influences in Elixir

[...]

> The main, the top three influences are Erlang, Ruby, and Clojure.

[...]

> I was like, no, but I’m going to call them protocols because there are a lot of similarities between Clojure and Elixir in terms of them being dynamic languages and in terms of the macro system. I was like, okay, I’m going to call them protocols because the closest thing we have today to what I want is Clojure

And he goes on talking about more inspiration and similarities from Clojure like Agents, etc.

Full exert is here: http://blog.cognitect.com/cognicast/120

Edit: Ah I see where you could have gotten confused. By "version of Clojure" I meant in that it is very similar and has taken a lot of inspiration from it. Elixir isn't an actual dialect of Clojure the way that ClojureScript and Clojerl are. That's not what I meant to imply. Having used both language, they do share a lot of similarity in design, with most of the differences being Beam/Erlang vs Jvm/Java, and Elixir pulling more from Ruby, while Clojure pulls more from Lisp. This is what I meant by "a version", I should have said "is like Clojure, but..." instead I think to avoid this confusion, but too late for me to edit now.


The way you use them and how you model the world with them seems very similar to me


I'm building my startup in phoenix.

First of all I wanna say that Clojure is a fantastic language and if the dials on my particular needs were different, I would have gone with Clojure and am considering clojurescript for a subproject paired with an elixir backend.

When I started the project, realtime over WebSockets were a huge consideration. Additionally, we weren't doing anything revolutionary from a computer science perspective. Phoenix came in with a clear story for all the work I wanted to accomplish.

There were well accepted and documented libraries for doing authentication and a really nice library for accessing the database.

The language has few gotchas and is relatively easy to learn. I have no doubt I could take a good js or python developer and have them be proficient within 2-3 weeks. Thats a big deal for when we are ready to onboard more people.

The elixir language feels a lot like clojure with a ruby like syntax. you have maps(structs) and a similar theme of 100 functions on one data structure. When sketching an idea, I can build my data structure out as a map and delegate to functions based on specific properties within the structure just the same as you would in Clojure. The language supports hygenic macros though I have been content with using the ones provided by absinthe and the kernel.

Phoenix itself is Extremely composable. Yes there are some constraints imposed by the language but no where near what you'd find in a more magical framework like ruby. In every case I've run into, I've been able to granularly pull and modify whatever functionality I've needed. middleware for instance is oriented around plug. Plug consists of a struct that contains data pertaining to the http request and response. ALL middleware is a function that takes a plug struct and returns a plug struct. Its about as composable as you're going to get. The end result is a very stable system that is really easy to reason about.

The biggest advantage, however, has been the deployment and infrastructure story. OTP is fantastic and lets us create workers about as easily as you could create a controller in rails. This is big. for our mvp, we don't need to setup redis or rabbitmq nor deal with the headaches of configuring them in prod. I can create a pubsub worker that responds to events and broadcasts data to the users in real-time and stay completely within phoenix.

Of course it has its downsides. For one, its definitely not my language of choice if I was doing image processing or constraint solving. At some point, we are going to create other microservices that handle those kinds of tasks better and when it happens, we'll have to pull in rabbitmq or kafka. Obviously phoenix can't have isomorphic apps like you would find with clojure and javascript.

TLDR: if you're trying to do something really novel, go with clojure. Its a much more flexible language with some really neat libraries that you'll need to learn to integrate yourself. If what you're doing is CRUD but with realtime, elixir will give you a great base ecosystem with sensible defaults to get off the ground fast.


There is another type of application where Elixir/Erlang really shines. The most obvious example of this type of application is a web based game where you have thousands of instances of the game running at once. The concurrency and isolation model is pretty much a perfect fit for this.

I was trying to hack something together in Java that wouldn't kill the database. Queries to table x would bottleneck, then table y. Add some caching here and there as each problem cropped up. But the obvious design in Elixir just removed most of the problems - each instance of the game works as its own set of processes and each instance holds what it needs in memory. It's not that I couldn't have arrived at this model with Java eventually, but it doesn't exactly lead you there, and a language like Elixir/Erlang was basically built with this in mind so everything is a lot easier to accomplish than with something like Java.

I really think everyone should learn either Elixir or Erlang. There are certain applications where OTP and BEAM just makes everything so much easier than the alternatives. If you have the right problem it can be an insanely productive language.


I had one case where I needed to store account data and ended up storing it in a gen server object for each account which pushed its state to all devices logged into that account. It was so easy to build I forgot about it but this 4-hour project would have taken over a week if I had done it in any other language.


Thanks for chiming in.

It helps to better understand the use case for each language.

I like the way you put it: Elixir = CRUD but with realtime.

Maybe I'll end up learning both, but have to start with one.

Hey and good luck with your startup. It reminds me of what PG wrote about - i.e. choosing the right tools to build your business matters [0]

[0] http://www.paulgraham.com/avg.html


You'll actually find it pretty easy to learn both. Elixir was very inspired by Clojure, so it works similar to it in a lot of ways. It is like taking Clojure and removing the Lispy aspect from it (which to me is the biggest downside of Elixir, as I love Lispyness, but that also makes it more approachable and familiar to people without a Lisp background).

The biggest difference will actually lie on the host platforms. Learning BEAM and Erlang standard library Vs learning JVM and Java standard library.

For complenetess, I want to point out there is also a Clojure variant running on BEAM/Erlang called Clojerl found here: https://github.com/clojerl/clojerl

Development is pretty active, and I think it is approaching maturity pretty soon.


> When I started the project, realtime over WebSockets were a huge consideration. Additionally, we weren't doing anything revolutionary from a computer science perspective. Phoenix came in with a clear story for all the work I wanted to accomplish.

Incidentally, my app uses websockets and real-time updates based on RethinkDB changefeeds.

But more to the point of this thread, one of the major advantages is that I use a single language for both client-side code that runs in the browser and server-side code that runs in a JVM. Same language, same data structures, no impedance mismatch, no crippled transit format. All the domain code is shared between both environments.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: