Micah Lewis

If you’re unfamiliar with Scala then you’ll likely come across and be confused by some code that looks like the following:

case class Rectangle (length: Int, width: Int)object Rectangle {
def area(rectangle: Rectangle) = rectangle.length * rectangle.width
}
val r1 = Rectangle(3, 7)Rectangle.area(r1) //returns 21

Why do we…