6 ms·
I assume by "non-native", you mean "non-idiomatic"? Since I recently went through coworkers writing "bad" (by which I mean non-idiomatic) Scala, and repairing
by ericssmith 13y ago
I assume by "non-native", you mean "non-idiomatic"?
Since I recently went through coworkers writing "bad" (by which I mean non-idiomatic) Scala, and repairing the situation, I can say that it was surprisingly easy to lay down "functional constructs" and the result was amazing. The code became reliable, well-structured, and easy to leverage. Switching to Scala for our projects -- including introducing procedurally minded programmers to it -- was a huge win for us.
- pspeter3 13y agoYeah, we discovered that for my team's projects as well. Having a scala "guru" define and teach idiomatic scala has actually increased our productivity a lot. Any non-idiomatic scala is now purely for interacting with our existing Java libraries
- ericssmith 13y agoFWIW, the constructs with the initial biggest win for us (in converting procedural thinking) were pattern matching and option types. For pattern matching, the guidelines were - Don't do any processing after the pattern match within a function; break into smaller functions - Reach for pattern matching before if/else - Avoid the use of var - Avoid dropping through to wildcard pattern. (This tip was from Yaron Minsky of OCaml fame) In conjunction with preferring the use of combinators over loops, and using Option (and being forced to think about None), we got surprisingly functional Scala code in a short time.
- ionforce 13y agoYou are correct; I should have said non-idiomatic rather than non-native. But idiomatic writers do feel like natives!