I think Scala goes too far from simplicity, like its syntax. For example Martin Odersky wrote the method in his book :
def calculate(s: String): Int =
if (cache.contains(s))
cache(s)
else {
val acc = new ChecksumAccumulator
for (c <- s)
acc.add(c.toByte)
val cs = acc.checksum()
cache += (s -> cs)
cs
}
If the methods grows, it becomes very painful to read the code, I can't match curly braces, can't fold the method in IDE. Is there any Scala coding conventions out there? I feel it's too flexible to express a simple method:
def add(b: Byte): Unit = {
sum += b
}
def add(b: Byte): Unit = sum += b
def add(b: Byte) { sum += b }