8 ms·
I have to admit I thought it was some kind of meta joke about the state of development right now. I just can't imagine many situations where you have cl/cljs c
by weego 9y ago
I have to admit I thought it was some kind of meta joke about the state of development right now.
I just can't imagine many situations where you have cl/cljs capable devs yet want to reject all the benefits of the jvm and use node
- shizcakes 9y agoThe JVM, for all it's benefits, comes with a significant number of downsides. Many folks no longer wish to operate a JVM when less bloated and clunky runtimes exist.
- kimi 9y agoLike what? :-)
- shizcakes 9y agoIn this particular case, it looks like the author is preferring to target the Node runtime.
- FieryTransition 9y agoWell, there is an OpenJDK version that azul systems make called zulu, which is open source and free from oracle. The jvm is still a really good runtime. Java is a way more consistent language than javascript. Other languages running on top of the jvm are way more beautiful and sensible than javascript. The jvm can be leveraged many ways when it comes to performance and use cases, and I consider it way more stable than different javascript runtime implementations running in different browsers coded by different organizations. Out of curiosity, why do you think the JVM is such a thing of the past and so bloated and clunky? I'm curious about what reasons people have. From my own experience, I get that javascript is easy to start things in, but damn, it can get sucky once you have to maintain and refactor a bigger codebase. It just feels like javascript and node gets a lot of mindshare since it is what the web industry pushes down everyones throat sometimes :/
- always_good 9y agoWell, you're writing ClojureScript in TFA so I'm not sure what Java vs Javascript has to do with it. But if you're interested in one way Node is nice: single-threaded + unified way to write async code.
- FieryTransition 9y agoFrom my understanding, the article is about leveraging clojurescript serverside on nodejs. Then someone asks why just not write in clojure serverside on the jvm. I just took some example languages, maybe I shouldn't have as it polluted my point with my own biases. It also felt relevant to bring them up, since it is what people mostly end up writing in, on those respective platforms. But I'm mostly interested in the JVM vs. node discussion though and opinions. Yeah, the single threaded model + async can be nice and resolve problems with race conditions etc. making one headache go away. But it can also be a limiting factor that you cannot change if you need to, but then you maybe choose the wrong tech to begin with if your use case can include high cpu usage etc.
- dahauns 9y ago>Yeah, the single threaded model + async can be nice and resolve problems with race conditions etc. making one headache go away. What often astounds me in these kinds of discussion: People just seem to assume that's not possible with the JVM. So, just for the record (not neccesarily directed to you :) ): You can totally do node.js style (event-driven, async, nonblocking, no-shared-state - "single-threaded", if you will) with the jvm, and it works great (e.g. vertx, netty, play and many others). And as you said: Contrary to node, with the JVM there's no danger of it being a limiting factor you're stuck with.
- always_good 9y agoNobody said it's not possible to do it on the JVM. It's also possible to do it in C. It's totally different. There is no unified solution. Just about every library is blocking the thread and you have to code around that. And the solutions don't interop. And they can be atrocious abstractions: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletionStage.html https://docs.oracle.com/javase/8/docs/api/java/util/concurre... I work with Netty professionally and I would not call that a pleasant experience. Async programming in Node has really good ergonomics that are hard to find elsewhere. For example, compare Promise.map(..., { concurrency: N }) to the Go solution.
- noobermin 9y ago>less bloated and clunky runtimes exist. Like cljs ontop of node?
- grzm 9y agoThis isn't particularly helpful. Do you have something to add besides answering a question with another one? People have different use cases and different needs, and in general is a good think to have options with Clojure/Script. If you think ClojureScript on node is misguided, please provide more argument as to why and help move the discussion forward, regardless of how wrong you might feel the comment you're responding to is.
- didibus 9y agoYou'll have to specify what you mean by the JVM being bloated and clunky. I think a lot of people are wrongly under the impression that the JVM is complicated, and annoying to use. It is not, Java is. Java is not the JVM, and in the context of Clojure and ClojureScript, the JVM is amazing. The only reason not to use the JVM I'd say would be cases where you need sub-second start times, or you have memory and space constraints, or need full real time. Though for the latter two, there exist paid JVMs that can work for those use cases. In fact, that's another amazing thing about the JVM, its a standard, and there exist multiple fully functional implementations. Some benefits of the JVM are its very complete standard library, as well as its gigantic set of third party libs. It runs on almost any imaginable hardware. It is extremely fast. All other VMs or even VMless GC runtimes benchmark themselves against it because its the known performance champion. It has amazing GCs, it even has more then one type of GC. It supports multiple programming languages, such as Clojure. It comes with top notch tooling support for debugging, profiling and monitoring. Finally, its backed by a lot of money, which means it keeps improving quickly. Some of its soon to be improvements are complete modularity, AOT compilation, faster startup time, smaller memory footprint, ability to call native code and use native data and finally support for first class fibers (like erlang and go threads).
- ledgerdev 9y agoI think you meant to say sub 20 second start times for clojure apps :) But seriously completely agree with you about the jvm being awesome. However clojure var load times on top of the base jvm and memory use makes it dog slow to start a development repl(30+ seconds is normal.. queue comment about how someone only restarts their repl every couple of days LOL) and unsuitable or unusable for situations where you care about app start times of less than 10 seconds and memory constrained environments such as cli, iot, serverless, android.
- swlkr 9y agoMy repl starts in about a second... maybe it’s because I’m using cursive
- 9y ago
- dahauns 9y agoMaybe, but what has that to do with node.js? badum tsss But jokes aside - the whole node environment doesn't strike me as particularly un-bloated or un-clunky, especially compared to modern JVM solutions like e.g. vertx, netty or even wildfly/undertow. Same goes for the pure runtime itself (i.e. v8 vs jvm), where v8 may be competitive at best, but hopelessly outclassed in other cases.
- vemv 9y agoI'd use cljs for Serverless architectures. There's JVM support in e.g. AWS Lambda, but JS is a more popular and lightweight target.
- frou_dh 9y ago"MACCHIATO: ClojureScript arrives on the server" Perfect for "Serverless" I want off this ride!
- vemv 9y agoServerless stacks do run on servers, and on node.js in this case.
- frou_dh 9y agoWe're drowning in obfuscation.
- benatkin 9y agoIt's on the server side, but you don't manage any servers. Serverless means you don't manage any servers, directly or indirectly. It's a step further towards where you don't own any servers. It's part of an evolution that has gone from being more aware of servers to being less aware: on-site servers -> colocated physical servers -> dedicated servers -> virtual private servers -> cloud virtual private servers -> autoscaled cloud VPS -> cloud functions where you you aren't billed by, or even aware, of the number of servers running I don't think "serverless" is a terrible term.
- vikeri 9y agoHow's that working for you compared to vanilla node on serverless? And are you using it for an API or just minor services?
- vemv 9y agoThanks for the question but I haven't tried it myself (yet). With Clojure(Script) whole categories of complexities tend to disappear, so I'd expect that to be the case in this scenario too.
- yogthos 9y agoThere are situations where you might want something lighter than the JVM. If startup time matters or you want a low memory footprint then JVM is not ideal. The other reason is that there are lots of people who work with JavaScript and are not interested in the JVM ecosystem. I think it's good to have an option that targets this demographic. One of the goals for Macchiato is to provide a Ring compatible API. This allows you to start projects on Node and move them to the JVM as they grow.
- deleted 9y ago[deleted]
- pjmlp 9y agoThe JVM startup is quite fast, and it can be made even faster when using a JVM that supports AOT compilation to native code. Slow startup of Clojure's code, it's Clojure own doing. The (Clojure) "JVM Slow Startup Time" Myth - http://blog.ndk.io/jvm-slow-startup.html http://blog.ndk.io/jvm-slow-startup.html
- yogthos 9y agoSure, Clojure adds a lot of overhead on top of the JVM. However, even large Java apps can take seconds to startup. If you're targeting something like AWS Lambda, that's a no go.
- lorddoig 9y agoServer-side rendering of React applications is a pretty good reason to use Clojure on node as your server. Definitely not my preference of runtime but it does make this (quite common) use case substantially simpler for at least small- to medium-sized apps.
- ledgerdev 9y agoHow about the huge number of companies that already use nodejs with great success, and don't want their developers to have to learn yet another platform(jvm), and be able to use a single platform for both server and client?