Hacker News new | ask | show | jobs
by vbezhenar 3381 days ago
> I find Scala's collection library a good example of that - programmers of all levels can use Scala collections without understanding all the type-level tech they're implemented with.

That was my reason to dislike Scala. It doesn't work for me. I must be able to dig into any library code I use. And when I tried to dig into Scala collections library, I ran away screaming in horror. When I tried to implement my own collection based on linked list, I wasn't able to do it. I was able to learn Java collections easily, they are really easy to use and understand. You just open Collection.java, List.java, ArrayList.java and read it, it's easy. It might be hard for something like ConcurrentSkipList, but this structure is hard, it's okay. But when I tried to read Scala's collection in the same way, I drown in traits.

May be there are people who can use libraries purely from interface and documentation perspective. I'm implementation guy, when I have a question, first thing I'm doing is investigating implementation code. And if implementation details are buried below kilometers of abstraction, I don't like it.

1 comments

The Scala collections library has a fair bit of second-system effect and plain bad design. It's being rewritten with simplification as an explicit goal (even at the cost of sacrificing some expressiveness) for the next major version of Scala. In the meantime there are a couple of alternative libraries, and fundamentally the standard one does work. (If you need to implement a custom collection the recommendation is to only implement an interface - or maybe even just a suitable typeclass - and not try and reuse any implementation traits/base classes from the standard library).

Which is to say, I don't blame you, but FWIW collections are a known-bad part of the language and exemplify a lot of what the community wants to move away from. I find Scala is great for being able to read the implementation of things, particularly in terms of how much the frameworks tend to be written in plain old Scala code rather than magic annotations or what have you (e.g. in Spray/akka-http, all the directives you use to define your web routes are just ordinary Scala functions and you can click through and read their definitions).