4 ms·
I'm a big fan of the guide that Twitter put together titled Effective Scala: http://twitter.github.io/effectivescala/ http://twitter.github.io/effectivescala/
by ajones 12y ago
I'm a big fan of the guide that Twitter put together titled Effective Scala: http://twitter.github.io/effectivescala/ http://twitter.github.io/effectivescala/
For those who want to learn Scala, Twitter has also put together a set of lessons called Scala School: https://twitter.github.io/scala_school/ https://twitter.github.io/scala_school/
- bad_user 12y agoUseful resource, but as often happens with lists of best practices, I do not agree with some things Twitter is giving advice on. For example - https://twitter.github.io/effectivescala/#Control https://twitter.github.io/effectivescala/#Control structures-Returns They are saying that "return" can be used for "reducing nesting". First of all, that's a lie - if a return exists in that code, doesn't mean that the branch no longer exists, it only means that it isn't explicit and far more effective for reducing nesting would be to break those functions in smaller ones. I happen to believe that usage of "return" in Scala is never appropriate and it was a design mistake; at the very least they abstained from adding "break" or "continue". Scala is an expression oriented language and really, if you're going to write Scala as if you'd write Java, then just pick Java because Scala, contrary to other people's opinions, is not a better Java in the sense that it actively works against you if you're doing things like that. I tried outlining the rationale in this rule, which I consider to be non-optional (hence the usage of MUST, instead of SHOULD :)) - https://github.com/alexandru/scala-best-practices/blob/master/sections/2-language-rules.md#21-must-not-use-return https://github.com/alexandru/scala-best-practices/blob/maste...