3 ms·
I've been to multilanguage conferences and every time someone throws a slide up with Scala code on it, I look around me and every damn developer has this sourpu
by pmarreck 10y ago
I've been to multilanguage conferences and every time someone throws a slide up with Scala code on it, I look around me and every damn developer has this sourpuss look on their face. (Almost like when anyone brings up Node in casual conversation, but I digress...)
Guys... if only experienced Scala people enjoy reading Scala code, then you kinda have an adoption problem
- the_af 10y agoUm, Scala "in the small" (for example, in a slide at a conference) is never a problem. It's 100% guaranteed to look cleaner than the equivalent Java snippet, with less boilerplate. I suspect it's snobbery if people get that look in conferences. Of course, Scala frameworks and its use in large systems might be different things -- though, having used Scala for my day job, I'd also disagree with that.
- pmarreck 10y agoFair enough. And to be honest I have not worked with it, and am probably biased by the conventions used in most other popular languages which do not carry over to Scala. It does seem like a disorganized kitchen-sink of ideas, though. And any time you allow mutability in any form (which would pretty much implicate any JVM language), you introduce the possibility of mutation bugs (one of the reasons I went over to functional langs to begin with... I once spent a month tracking down an irreproducible intermittent logout bug which ended up being based on a mutation bug).
- the_af 10y agoAgreed about the kitchen-sink of ideas. Also agreed about the mess of mutability and compatibility with JVM. But that's hardly something you'd notice looking at a slide in a conference :) I also prefer cleaner languages. But, in practice, I must choose between Java and Scala, and I'd choose the latter any day, with my eyes closed!
- pmarreck 10y agoIf those are your choices, then your choice makes absolutely the most sense!
- spiderjerusalem 10y ago> And any time you allow mutability in any form ... Odersky often says that the mutability should be as 'contained' as possible in what is otherwise a largely immutable codebase. If you can reason cleanly about a black box and are sure that the mutable variables within are not going to 'escape', you get the benefits of both 1. easier to implement, imperative algos which have been around for decades. (the alternative in pure FP is to convert stuff to tail recursion, which is not always the easiest thing to do, let's just say.) 2. easier reasoning about state not leaking to the rest of the system. I've found following these guidelines to be very helpful.
- pmarreck 10y ago> Odersky often says that the mutability should be as 'contained' as possible He's 100% correct (at minimum). > the alternative in pure FP is to convert stuff to tail recursion It's a challenge but not THAT difficult, once you get the hang of it. :) I've found conversions fun, actually. Especially when you (of course) have to learn how to trigger TCO. The irony here of course is that at the machine language level, the recursion is converted back to imperative via TCO. But IMHO the resulting recursively functional TCO code is, eh, "more beautiful"