5 ms·
Need someone to explain why I should use clojure over scala because typelevel seems pretty well developed
by nautilus12 7y ago
Need someone to explain why I should use clojure over scala because typelevel seems pretty well developed
- justinhj 7y agoSpeaking as a professional Scala developer I can’t explain why you’d use one over the other. They are very different yet I know people that successfully develop and ship software using one or the other. I think it comes down to personal preference
- serpix 7y agoClojure: live repl into running code Scala: Clojure: Explore the problem you are facing with quick prototyping in the repl and see the blind spots, the unknowns, the shape of data received from flaky integrations. Mold and shape your functions as the problem becomes clearer. Scala: Best it can do is write unit tests and the debugger to look at what exactly is happening, devise a bunch of classes to handle them, rinse repeat and of course wait hours for recompiles. Refactor when new unknowns surface and curse at the fucking compiler not knowing what type it should be inferring. Clojure programmers are done before Scala has a test environment up.
- joneholland 7y agoScala also has a live repl.
- serpix 7y agoPlease provide link as I need one. Ammonite is not it though.
- bobbyi_settv 7y agoI use jupyter notebook for Scala. I like having the same repl software for multiple languages. The kernel I use (almond) is based on Ammonite, but I believe there are others out there.
- iLemming 7y agoPlease don't try to compare Clojure REPL (or any Lisp REPL) with jupyter notebooks or something similar. The latter are mere "interactive environments" compared to "real" Lisp REPL. You have to actually try Clojure REPL and see what makes it so special.
- serpix 7y agoThank you for the jupyter notebook tip though. As I do have a biggish Scala app to maintain any help with it is good. :) Thanks again.
- tensor 7y ago> Explore the problem you are facing with quick prototyping in the repl and see the blind spots, the unknowns, the shape of data received from flaky integrations. Mold and shape your functions as the problem becomes clearer. This is a great way to end up with undocumented code with no tests. The repl definitely encourages this process, but you should be doing this via quick running unit tests rather than the repl so that when you are done you already have a set of tests. Otherwise tests are an after thought and usually after thoughts are either not done or done poorly. edit: you can always run your unit tests via the repl too, if you'd rather not use a fast test runner.
- justinhj 7y agoI'm sure you're happy with Clojure and I'm not going to try and convince you Scala is better but you have some misconceptions. Firstly Scala does have a couple of REPL's, the best being Ammonite which is mentioned below. It can be embedded in code to provide a live repl just as your Clojure program. I often work in Scala in a similar way to I work in Clojure; creating and testing new types and functions in the repl before moving them back to a source file. The way you build programs sounds quite horrible, but I know people do it that way and it works well enough. Your complaints about long compile times are largely irrelevant. Incremental compilation means it's usually 2-3 seconds at the most before I can test a change. We don't build programs as a bunch of classes by the way, that would be OOP. Scala is more commonly written in a functional and/or streaming/reactive stle. Also I'm glad you brought up refactoring. It's a breeze in Scala because of the strong type system. Poorly defined data can be expressed just well in Scala with types as it can in your blob of maps of maps, and it's much easier to work with. Finally you may finish your program first; it appears to do the thing you want but you can't really be sure. There will be more runtime errors such as NPE's and type errors because you don't have mechanisms to remove them from possibility. I'd much rather maintain and evolve a Scala program.
- the2bears 7y ago> Scala is more commonly written in a functional and/or streaming/reactive stle. This is the exact opposite of my experience. All the Scala I've seen "in the wild" is basically Java with a slightly different syntax. All OO, with the odd high-level function thrown in to prove something I guess.
- valw 7y agoNot going into this explanation (as I believe the qualities of languages can only be assessed through experience, not theoretical arguments), but I, and many others, have been through Scala with high hopes before finally settling for Clojure - this should tell you that there are indeed good reasons for favouring it. An analogy to pique your curiosity: I would say that if Java was a balloon, Scala would be a zeppelin, and Clojure would be a plane. I would also say that the stewardship of Clojure is much saner than that of Scala, due to a strong emphasis on stability. Typesafe / Lightbend is bigger than Cognitect, but big does not mean reliable. One sign of this is that Clojure now grows via libraries, the core having reached stability. Scala is still figuring out its fundamental semantics.
- blunte 7y agoClojure is concise, expressive, not noisy, opinionated (with generally appreciated opinions), dynamically typed, a Lisp, functional with some escape hatches (but not confused with being FP and OOP), and built to solve real problems. Scala is either the opposite of these, or at least not as much of these. IMO, less code is better. Clojure is about as terse as you can get and still be readable (by my opinion). Scala is very visually noisy in comparison. While you can do types with Clojure.spec, you get to choose when and use when useful to you. Rich Hickey is the best communicator of why Clojure is good. Here's a relevant starting point a video talk he gave on the 10 year anniversary of Clojure: https://youtu.be/2V1FtfBDsLU?t=1636 https://youtu.be/2V1FtfBDsLU?t=1636 All this said, Scala has more jobs than Clojure in the same way that Java has more jobs than Scala does. It's more Java-like than Clojure (and not just because it isn't Lisp). (And incidentally, only people who haven't tried at all to use Clojure complain about parens ().) Sadly, I think Javascript is the long-term winner. Python is also a winner, but it doesn't have the front-end reach that JS has (while JS also has server side). Clojure and Clojurescript can do both, and are an awesome choice if you don't mind working alone and having few job opportunities. However, if you want to focus on one language and be able to do a lot of things, and have lots of job opportunities. Javascript is actually the one I would suggest.
- slowmovintarget 7y agoThough Clojure jobs tend to be the highest paying. https://insights.stackoverflow.com/survey/2019#top-paying-technologies https://insights.stackoverflow.com/survey/2019#top-paying-te...
- hota_mazi 7y agoIt's pretty common for niche languages. The fewer developers there are, the higher they are likely to be paid. These jobs are pretty much impossible to get, though.
- christophilus 7y agoI suspect this is because Clojure developers tend to be more senior.
- ken 7y agoI feel I see Scala brought up in response to almost every Clojure post, but I can't tell why. They seem like polar opposites. Clojure has a simple syntax and dynamic typing and no classes, while Scala has a complex syntax and classes and static typing with inference. Why would someone looking for one be interested in the other? Is it just because they both run on the JVM? For all my Clojure projects, I picked the language despite that, not because of it. It's merely an implementation detail.
- didibus 7y agoMy personal reasons are: 1) Clojure is more fun, more interactive and interesting. 2) You learn a lot more, more quickly. In Scala it's easy to just fallback to writing classic OOP with a nicer syntax. Clojure forces you to learn FP, meta, logic, etc. much sooner. 3) I'm more productive in it. 4) The interop is way better. 5) Compile times are instantaneous. 6) The community is friendlier. 7) New versions are always backwards compatible, Scala often breaks compatibility and updating is annoying.