Question: I am learning Scala and Akka and in my recent lookup for a [solution](https://stackoverflow.com/questions/22770927/waiting-for-multiple-results-in-akka), I found something like 

```
 case class TotalTaxResult(taxAmount:Double)
 case object TaxCalculationTimeout

```

What is the difference between the two?

When should I use one over the other?

Answer: 
A case object is a singleton case class. They are used kind of like enumeration values. It can be used in pattern matching just like any other value:

```
TaxCalculationTimeout match {
  case TaxCalculationTimeout => println("hello")
}

```

When you define a case class, you are creating a template for instances of that class. `TotalTaxResult(1.0)` and `TotalTaxResult(2.0)` are two different values of the same type. Whereas there is exactly one `TaxCalculationTimeout` value.
You can think of these two to be just like a class and an object in general.
When you do a case class ClassName(params list) it creates a blueprint for making objects and case object defines a singleton object in the scope in which it is declared.
Starting with Scala 2.10, you should always use case objects instead of case classes with no arguments.
So when you want to do a pattern match on some values which need arguments you should go for a case class, but if your values don't take arguments then you should use a case object.