scala coding practice