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

Scala has been very enjoyable and productive for me and the teams I've worked on. The first couple years of v2 -> v3 transition were a bit rough as the tooling and ecosystem was catching up, but now we happily use Scala 3 with no looking back. The language and ecosystem are evolving in a good direction, and I'm happy to play a small part in that with my open source libraries for Scala.js (which is the entire reason I got into Scala in the first place – so much simpler and safer than Typescript).

Scala is perhaps not going to replace Java in every old enterprise, but in my personal experience working for startups, it's been an awesome force multiplier for small teams who need to productively pump out safe and ergonomic code. Finance, health systems, etc. And yet it's also ergonomic and pleasant enough for me to eagerly use it in my non-mission-critical personal projects as well.



> it's been an awesome force multiplier for small teams who need to productively pump out safe and ergonomic code.

How much of this would be due to actual language features, and how much due to selection bias induced by talented and ambitious software developers looking into functional programming languages as a means to satisfy their intellectual appetite?


I've worked both at a startup that used functional programming libraries pretty heavily, and a startup that is using as plain of a Scala as you can imagine (no cats / zios / kyos / etc. in sight), and both benefited greatly from Scala language itself. The rich, safe and sound type system, combined with ergonomic syntax and well thought out features make it very easy to both read and write code – and most importantly – to make massive changes with very high confidence – which is an absolute necessity in a fast moving startup where the business requirements evolve all the time, features are shipped urgently with some tech debt that needs to be effectively addressed later, etc.

In terms of talent there is definitely some self-selection as with any non-default tech stack. Scala is a sharp tool and there are both people who are attracted to it for the pragmatic utility of its sharpness, and people who are attracted to it for wanting to play with sharp things. Both types are smart but the latter group have given Scala a bad rep in the past for being too smart and thus writing code that was too clever for others to understand. But nowadays the general vibe in the talent pool is a lot more pragmatic.


> I've worked both at a startup that used functional programming libraries pretty heavily, and a startup that is using as plain of a Scala as you can imagine (no cats / zios / kyos / etc. in sight), and both benefited greatly from Scala language itself.

Wouldn't you want to use Kotlin for the latter these days? It seems to have broadly wider adoption than any "plain" variety of Scala.


I don't know, kotlin has its pros, and is absolutely here to stay due to Android alone, but I always felt it being more or less just syntactic sugar for Java 8, to the point that now even Java has some more advanced/elegant features, like proper pattern matching with algebraic data types, while Kotlin is stuck with dumb sugar for instanceof checks.

Scala was always much more elegant and actually going the extra mile.


Kotlin's adoption is not that much bigger than Scala, and it's no good to me, as it's heavily concentrated in the Android world, which is irrelevant to me. Among other things, that means that Kotlin.js is not as good as Scala.js, both itself and in terms of the ecosystem – and the quality of Scala.js is half the reason I'm using Scala in the first place.

Kotlin as a language is also closer to Java on the Haskell <---> Scala <---> Java spectrum. We just don't want to move in either direction on that spectrum, Scala sits perfectly where it makes sense to us.

It's interesting that some people here are saying that Java's recent improvements will eat into Scala's market, when actually, it seems that it will eat into Kotlin first.


Could you give an example of a massive change that was made easier by your choices?


I've had a (relatively) bad time with Scala codebases. The last one I was involved in was like a 6-minute wait between making a code-change and being able to run or test it. But I still wanna work with Scala devs.

I'd rather work with Scala devs on a Java codebase than Java devs on a Scala codebase.

It's not about intellectual appetite though. It's about not re-litigating the same crap at every new work place. Avoid mutability and nulls where possible, etc.


> I'd rather work with Scala devs on a Java codebase than Java devs on a Scala codebase.

And Java devs on a Scala codebase is effectively the norm once your project enters BAU/maintenance phase.


One of Scala’s major issues is that it’s too easy to write Scava IMO


its a feature not a bug


The problem is that it is easy to write code that is not easy to read/understand afterwards. Especially if the code has a lot of operator soup and implicits.


Do people still do that? I thought that the whole "you can just google goobedygook" meme died already! ZIO for this reason has sane normal proper names for things for example.


Type system makes a huge difference especially things like refined types:

https://github.com/Iltotore/iron

Shifts entire classes of errors to compile time.


Most underrated library in the world


Scala is not just a good functional programming language. It's also possibly the best OOP language around. The magic happens when these two aspects are combined.


This has been my personal discovery as well. I inherited a bunch of old Scala code and, having had no experience with Scala, it took a while to get up to speed.

But once it clicked, it's been a joy to work in.


What kind of applications have you built in it? GUIs, or web? Mobile perhaps? AI? Does Scala have strong/weak areas here?


So I have built all sorts of applications using Scala:

- Desktop GUI app which used Tauri/Rust but heavy Scala.js on the frontend

- Cloudflare Workers using Scala.js

- Web apps using Slinky React [1] and Scala.js

- Highly concurrent, fiber-based backend apps using Scala and Ox [2]

- OpenAI model inference against ultra large datasets using Scala, Spark and MS Synapse

- CLIs using Scala Native

[1] https://slinky.dev [2] http://ox.softwaremill.com


We built full stack web applications: Scala on the JVM on the backend, and Scala.js on the frontend. For the frontend, used React.js (via Scala.js bindings) at one company, and my own Scala.js UI library Laminar at another. Mobile was implemented as a responsive web app. I've read that you can even use React Native from Scala.js, but we haven't needed that, so I haven't tried. The older React.js bindings were somewhat cumbersome, but the newer ones (slinky.dev) were great. The rest worked very well.

Working in a single language across frontend and backend is amazing, especially when the language is so nice. Sharing models, codecs, validations, etc. And again – all of that in a very friendly language. Scala's expressive yet safe type system is very good at describing the business domain, encoding constraints, etc.

The only weakness of Scala.js I would say is it takes a bit more effort to integrate with JS libs. The mechanism is the same as with Typescript – just need the type definitions, but in practice it needs a bit of manual work. It's not a big deal though because with Scala.js you don't really do the 200-npm-dependencies thing that so many JS projects are cursed with. Lots of stuff comes with the language or from nice Scala libraries, including immutable data structures, powerful collections, validations, state management, etc.

Scala has somewhat of a reputation for being complex, but the language itself is ecstatic in its simplicity and elegance. The problem historically lied in certain functional programming libraries that require a certain formal / academic mindset to work with. They did become more ergonomic and better documented with time, but those are still very advanced concepts for most devs. I did work with such a codebase, and I have to admit it was not the easiest. But that was before AI – nowadays it's a lot easier for me to figure out these things. But I don't need to, at my current job we don't use them. So I would advise to learn Scala the language before going off the deep end into hardcore FP libraries. That's a completely optional destination that you don't need to force onto yourself if that kind of style doesn't jive with you.

Speaking of AI, I've been asking both ChatGPT and more recently Claude about Scala 3 and about functional programming libraries, and they're pretty good. I don't "vibe code" so don't know about that, just asking for code snippets or for explanations.


I think a lot of criticism of Scala comes from the functional paradigm. More specifically it’s trying to be a mainstream language when the concepts it represents are not quite mainstream concepts for most software. The language designers, in an attempt to make it more mainstream, allow devs to use Scala in the more mainstream way (object oriented). This flexibility, ultimately, perhaps strangely, appears to hurt its adoption because of the learning curve of dealing with a language that mixes the two concepts.

Also for me, subjectively, it honestly feels too abstract at times. You can almost feel the academic joy of the beautiful, unintelligible concepts where you can express things so succinctly, but requires a small mountain of concepts to understand how to write that nice code. It’s quite frustrating to do battle with the compiler when you don’t fully understand the type system and that initial hurdle is kind of tough to get over if you’re also trying to switch into a functional paradigm from an objected oriented one.


The problem with overly abstract concepts is a problem of specific Scala functional programming libraries, and not of the Scala language itself, or of other, simpler Scala libraries (e.g. com-lihaoyi stuff, Play, my own Laminar on the frontend, etc.)

If you need to know category theory concepts like Monad / Semigroup / etc. in order to understand your code, you're not doing regular Scala, you're doing Haskell-style FP in Scala. Which is a popular choice that many people swear by, but is entirely optional. Personally I don't think the complexity of that approach is worth it, and we don't use any of that stuff at work, and still reap the benefits of Scala.

Scala is a true multi-paradigm language, it does not have a monoculture. Lots of people who use Scala don't use highly abstract FP libraries. I very much don't think that the OOP side of Scala is the language designers' concession for the sake of broad appeal. Seamless fusion of FP and OOP is the essence of Scala, and it works great for that without any third party libraries. The designers' attitude is evidenced by the libraries created by their companies (e.g. Play, Akka) and by the learning materials, both of which lean heavily on plain Scala without going off the deep end with FP libs.


> If you need to know category theory concepts like Monad / Semigroup / etc. in order to understand your code, you're not doing regular Scala, you're doing Haskell-style FP in Scala

FWIW, "Semigroup" is not a "Haskell concept" either. Equally, it's a facet of specific Haskell functional programming libraries, and not Haskell itself. Granted, Monad is baked into the language (as do notation).


> I think a lot of criticism of Scala comes from the functional paradigm.

Which functional paradigm. There are at least two in common usage in the Scala community. Odersky's vision was an ML style FP. And now ML patterns are common in modern PLs.


I dont know. I feel the same way you do about Scala but love FSharp even though it is also both functional and imperative/OO.


Interesting. Maybe it’s because the scope and focus of F# is smaller and doesn’t cause the sort of analysis paralysis Scala does?


How far is Java 24 from catching up to Scala though?


Java will never "catch up" to Scala (for example, the type system / generics will not evolve in the foreseeable future).

But once Valhalla lands, with some additional JEPs, Java will be very close to the core of what Scala offers. Where there are gaps, some of these can be filled via libraries (think immutables.org, or others providing persistent data structures).

As a matter of fact, these days at most companies that I see the typical deployment model is "micro"services, which you can quickly develop via Spring Boot or the alternatives. No need for ultra complex code or asbtractions, Java does it just fine. And you have all the tooling you need for the enterprise world.

I think Scala is an excellent language for teaching ML-style programming. I would still recommend it for that purpose. But there is no longer a killer app or need for Scala, that would convince most people to use it for new projects.


Just like Scala by virtue of being a guest language on the JVM ecosystem, never will replace Java on the minds of JVM architects.

Kotlin has an advantage here, because ART nowadays is effectly KVM from Google's point of view, where they grudgingly update Java support to keep up with Maven central.

Scala has nothing like this, and the update on Python alongside native libraries, kind of stole its demand in big data, hence why this kind of scenarios is described on the article.


They're not in the same playground. Scala has a far more advanced type system - more close in power to Typescript or Rust than Java - and capabilities like compile time metaprogramming which aren't on the Java roadmap. Or more mundane things like immutable collections or a copy method for "record" classes.

Whether that's an advantage in day to day business development is a different question.


Just as context for anyone curious:

Scala is even more "powerful" than TS or Rust as it has real HKT (higher-kinded types), and for example Effect.TS needs to emulate/simulate it.

https://github.com/Effect-TS/effect/blob/main/packages/effec...


Probably never. It's very slow to move.

Yes, Java has been getting a lot of features Scala has had since (more or less) always. But it's a continuing process, and not all such features are yet fully fleshed out and polished in Java.

Also, Java will probably never get many of important features Scala has (or will have). It may not be some esoteric things, like higher-kinded types. But things like meta-programming/macros. Or features which may be advanced from theoretical point of view, but are actually easy from user point of view (because they lead to a simpler code), like Capture Catching.


If capabilities (Capture Catching) proves to be very useful (and really solves the problems it claims to be able to solve) then it's likely that Java will also implement it, no? So... in about 8-15 years?


I doubt it. For Capture Catching of Capabilities to work, you need some of the unique sauce practically only Scala has. E.g. Contextual functions or path-dependent types. Java almost certainly won't adopt these.




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

Search: