Tagged in

coding

Rubrik -  - Scala: Concise, Clean Code for Humans

Architecture

Scala: Concise, Clean Code for Humans

Let me ask you a simple question: which do you think is a more natural way of thinking? I am going to go home and take a nap. My present location is “office,” and my state of wakefulness is “awake.” I am going to change my location to “home” and then change my state of wakefulness to “asleep.” The answer is probably a unanimous and resounding “the first one!” But when we write code, it is almost always an example of the second one. Here at Rubrik, while expanding the frontiers of Cloud Data Management, we are also passionate about the psychology of programming and shortening the learning curve for new developers. So, we look for innovative methods to reduce the cognitive load that programmers deal with. That’s where Scala’s magic shines! In this post, I am going to walk you through how we leverage Scala’s expressiveness to write cleaner, leaner, and more meaningful code. For this example, we’ll write a simple simulation for modeling backup operations and how they consume space. For starters, let’s simulate, using a toy program, what happens to occupied storage space when we take a snapshot: [crayon-5c0e6e5ba5163305298423/] No code is done without unit tests, right?…