Hacker News new | past | comments | ask | show | jobs | submit login
Transitioning to Scala (medium.com/p)
29 points by jlward4th on April 4, 2014 | hide | past | favorite | 7 comments



I think this is a well-thought out article. We use Scala quite extensively at Hulu, and it is important to use its more powerful features only when they really make sense. You can do quite amazing things with the language, but it doesn't mean you should.

I think a classic example of going overboard with Scala is a dispatch library - even as someone who writes Scala extensively, it is incomprehensible to me. On the other hand, for certain tasks, being able to craft an internal DSL is a great thing. For a hobby project I once wrote a DSL for a simplex solver in Scala, turned out pretty neat: https://github.com/ZenBowman/AIMA/blob/master/src/test/scala...

And then there's a great version of embedded BASIC in Scala: https://github.com/fogus/baysick

With great power comes great responsibility, and it is important to remember the Perlis rule: Syntactic sugar causes cancer of the semicolon


Good article.

Reminds me of the fact that though Thoughtworks has Scala listed as a language to adopt, they narrow it down to "the good parts": http://www.thoughtworks.com/radar/#/languages-and-frameworks...

I really wish the language was less like C++ in that you need to know 1000 things to read other people's code. But other than that, a really wild future for Scala.


Interesting article. I'm puzzled by one example, though. When the author says he favors the signature:

    def reverse[A]: List[A] => List[A]
while Tony Morris would argue for:

    def <-:[A, B](f: A => B): List[A] => List[B]
I'm puzzled. They are not two different styles of writing the type signature for the same function! You can tell at a glance that the type signature for "<-" allows functions more general than "reverse". So he is not talking about the same function.

Or did I misunderstand something?


Good point! I should have clarified that example, I didn't make it clear enough that I wasn't comparing apples to apples. Both are examples from a blog post of his and I didn't want to rewrite either, more or less point out that "he likes functions that look like this" and "he doesn't like functions that look like this" while I had the opposite preference. I guess the spirit is that un-opinionated languages can always benefit from a good debate about style.


> That’s the beauty of Scala. Tony is right. I am right. There’s no wrong, there’s simply a matter of personal and team preference.

That's not really a good thing; at least not for maintainability. You have to learn a new grammar for every codebase.


Valid point and one I've thought a lot about, especially before pitching Scala.

IMO, most non-trivial codebases require learning new grammar. I spent a few years working in Capital Markets and those guys were hacking together their own DSLs in Java for foreign exchange trades, etc. Looked nothing like Java. Libraries like that are almost guaranteed to be written/rewritten in Scala as more banks adopt it. Grammar is as much a business domain concept than a programming language concept, so cool that Scala supports different lingos so well. Hopefully in the future we won't see as many poor workarounds for language inflexibility, Ie, all the horrible duck programming done by IBM with WebSphere Commerce.

Grammar aside Walmart is a different beast than most apps. Handling huge spikes in traffic (Ie, Black Friday) was more a factor than new hires learning new grammar. We also had to handle massive amounts of data for catalog processing with Akka which wound up nearly being a DSL in itself. Pairing and a solid dev process is so important. That said if I worked on a different app with different reqs, less spikes in traffic, more developer turnover, etc, I may have used something else. Lots of factors to consider.

Grammar is definitely something to watch with open source Scala projects though. We'll see if a more canonical lingo develops over time.


Speaking of grammar: "i.e." means "that is" and "e.g." means "for example".

Sorry, it really bugs me.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: