I work in a Scala shop. We are a small start-up. When I arrived, the CTO was the only developer on the back-end and we were inheriting a large ill-written ruby codebase. Fortunately, the CTO told me that the first “task” was to rewrite everything in Scala. So we did, and now we are an Scala shop.
Our lifes are fulfilled with happiness; but that’s not true for the new members of the team. The company is in South Florida, a place were only old people and spring-break-teens want to move in. So we pick developers that are smart and eager to learn, even if they don’t have any experience with Scala or functional programming in general, which they never have.
The new members learn as they go, since we can’t wait for them to be comfortable with Scala. This has gave me the opportunity of witnessing all kinds of code: from the carefully crafted that our CTO produces, to the crude, and often pragmatic, that our less experienced developers write.
One concern of theirs is that they might not be writing a “worthy” code. I also had that problem when I started. I have come to consider that craving for the “right’ code, is one of the worst dangers when learning Scala. There are too many ways of doing it right, the doubt can be paralyzing.
One of the developers asked me if I was OK with his code having vars. I told him I didn’t really care, but he should be careful about passing those vars around, they should have a limited scope; then I gave him a little talk about immutability and its benefits. This happened a few times. Of course, what he understood each time was that vars were OK, and he just kept going on with his work. Eventually he hit a wall. His code had a bug, one of those hard to grasp. His code worked well when testing under controlled conditions, but always failed when the concurrent reality was added into the mix.
Then something happened that made all those little talks to worth their while: I suggested him to look for shared state somewhere. He found the bug, and I could see right there, when he was telling me about his findings, that he finally understood the benefits of immutability.