Scaling Scala
oreilly.com
oreilly.com
Odersky often uses criticism to refine future versions of the language. He is currently my favorite benevolent dictator.
Is your project just a tool to get a job done or do you draw some sense of self-worth and life purpose from it?
Former is a healthy attitude, latter would make your life miserable.
* < 50 million rows: Can your data fit into a standard RDBMS? Writing all your business logic in SQL might make more sense.
* < 1 billion rows: Can your data fit into a few flat files on disk, with some Python/Perl scripts to manipulate them?
* < 1 trillion rows: Can you use an off-the-shelf solution like Google BigQuery or Amazon Redshift? You can also use this rather than flat files depending on the skillset of your team.
* < 1 trillion rows: Can you engineer smart data structures & algorithms, write some custom C++, tune the compiler flags, inspect the resulting assembly, cache intermediate results on disk, etc. for a small number of core queries?
For anything larger, good luck. You seem to genuinely need a dedicated data engineering team, and similar tools may very well help you scale up. Even so, try to keep things simple. A single binary with well-defined inputs & outputs(even poorly written in C++) is intrinsically simpler than a distributed network(even if the Scala code itself is simpler and well-written), just due to deployment considerations.
If you need things to be accessible in real-time from a website, that may also require a sophisticated solution. Consider if you can queue the query and use one of the above approaches, however. It's even harder to deploy a real-time distributed query system with worst-case performance guaranteed to be queryable from the front-end of your website.
Scala core library is littered with :: +: and other nonsensical operators. Things like implicit may have few good use cases, but are mostly abused and make code hard to read. Blindly following immutability in even local function variables and stack makes code slow and unreadable.
As for immutability making things slow... Well, personally I start writing code for humans (and immutability makes the code much easier to read for humans). _If_ speed is an issue then I consider dropping immutability. So far have had no issues with Scala. Also depending on how much speed I need I wouldn't even think about using Scala.
Granted, scala can be written to read much easier than perl, but that argument in particular don't carry much weight imo.
In Scala, it is just hard, but doable, but implies code being hard to read because what you are doing _is_ hard. This does not detract from doing as much as you can to make it readable, but sometimes it is impossible, or at least impossible to someone not used to it.
I'm not good enough with Scala to understand some of it (yet, I hope) but this is something that is bugging me lately. Some things (in general, I'm not talking just about programming here) are hard. No matter how much sugar-coating, some stuff is hard to understand, complex and not everyone can get to the bottom of it. It just happens in some programming languages, happens in most of mathematics, physics and computer science.
They are very useful. With the two you mentioned (:: and +:) they can be used for pattern matching in addition to concatenation (of a list / sequence), for example:
scala> val list = 1 :: 2 :: Nil
list: List[Int] = List(1, 2)
scala> val x = list match {
| case head :: _ => head
| case _ => 0
| }
x: Int = 1
scala> val seq = 1 +: Seq(2, 3) :+ 4
seq: Seq[Int] = List(1, 2, 3, 4)
scala> val y = seq match {
| case a +: _ :+ b => a + b
| case _ => 0
| }
y: Int = 5
It can be a bit confusing at first, especially for mutable vs immutable collection operators. But you end up remembering some, if not most of it, after using them a number of times.Scala on whole is optimized to have lesser no. of characters in code, in contrast to verbosity of Java. Case classes and lambdas are what good came out of it, I understood the concept and now I can use them. Operator overloading and Implicit are what move pendulum to other side, they are not some novel concept and make very readable code, unreadable.
Concatenating to a list and pattern matching are extremely frequent operations in Scala. Some of the operators they use have been in use for decades in the languages that influenced Scala.
Like many features across many languages it can be taken too far at times and people that enjoy Scala talk about them all the time. That said, the similarities of your example to operators I use at the command line every day makes it nice to read for me.
Java also stagnated, because money obssesed Oracle is not earning much money on it.
Non profit and closed source seems like a formula for doom and destruction.
Which is not the situation here.
Also the work on Dotty seems to be progressing apace, folding the community in quite a bit (https://contributors.scala-lang.org and https://github.com/lampepfl/dotty/issues)
Regarding Kafka, I noticed a large amount of Scala API is deprecated and replaced with Java API in the latest version. There is about twice the Java code in Kafka as compared to Scala.
Mesos is C++.
Cassandra is Java.
So it seems to me Spark and Akka is mainly Scala. And in this field I am expecting Rust to make big inroads with high performance, no JVM like overhead for memory safety, and lately emphasis on async IO with tokio.
He's helped me fix MANY stupid type puzzles, and scalaz scumbags ran him out of the entire language.
I mainly do f# and erlang now :(
Scala has plenty of problems aside from the users. I can't begin to explain how terrible sbt is to people who haven't suffered its grasp. Sbt imo is the single most critical obstacle preventing widespread adoption. It's awful.
There's too much politics in the scalaverse. The people are too whiny, the tooling whines even more than the people, and its a damn shame because it's really great code at the end of the day. Its the most fascinating objfunctional I know of, though F# isn't bad at all. Great tooling too, but poor native support.
What's good about it? What about sbt makes it better than any other build tool OTHER than the fact that it lets you use scala?
I don't mind that SBT uses a bunch of advanced concepts and type safety, that's fucking AWESOME, but it's so difficult to wrangle it to just build something correctly, it seems like there's such a huge time investment to learning it to a threshold where its features are useful enough to make that investment seem worth it.
Several years later, I still have not reached that point. It seemed like such a pain at first to learn other languages (Erlang syntax still confuses me sometimes) but then I started completing components in these languages and there were moments when I started working on prod builds, and using rake, FAKE, rebar3, etc, and it really put into perspective how much time I had been spending internally screaming at sbt to just DO IT already.
There will always be a special place in my heart for Scala as a language, and I think it's one of those languages we'll look back on in 3017 and think "Damn, we learned a lot then"
but I'm getting over it in my day-to-day work. I'm also being slowly enslaved by .NET corp overlords now, but I've been complaining about SBT for a LONG time before this, and a lot of other people have too, sometimes for the same reasons that I hate it, sometimes for their own special reasons.
It causes way too much friction for Lightbend to continue to look the other way. It's cool when you read the list of features, but write a complicated build and look me in the eyes and say you enjoyed it, you just can't.
And I also don't want to learn another jvm build system. I've long awaited a day where scala native can start replacing things, but they've already put their sbt in their coffin.
The CBT author and community seem determined to genuinely make it a completely viable SBT replacement (it already works pretty well).
Given that during the earlier part of my career starting a new SBT project would involve 1 - 2 days of wrangling every time (there's always something simple that needs changing, that's inevitably harder than it need be in SBT), I can't wait to see CBT mature.
[0]: In their own words: 'fun, fast, intuitive, compositional, statically checked builds written in Scala'
Lein is what I always wished sbcl had.
Cats is more approachable than Scalaz. Whilst you could ostensibly see it as an extension of their CoC principles, I think Cats mostly just benefits from being much, much newer and so has more freedom and power of hindsight.
https://www.reddit.com/r/programming/comments/6bh8xv/leaving...
Google / Apache re-implemented the APIs in a way that conflicted with the GPL.