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 class can take arguments, so each instance of that case class can be different based on the values of it's arguments. A case object on the other hand does not take args in the constructor, so there can only be one instance of it (a singleton, like a regular scala `object` is). 

If your message to your actor does not need any value differentiation, use a case object. For instance, if you had an actor that did some work, and you, from the outside, wanted to tell it to do work, then maybe you'd do something like this:

```
case object DoWork

...

def receive = {
  case DoWork => 
     //do some work here
}

```

But if you wanted some variation in how the work is done, you might need to redefine your message like so:

```
case class DoWorkAfter(waitTime:Long)

...

def receive = {
  case class DoWorkAfter(time) =>
    context.system.scheduler.scheduleOnce(time.milliseconds, self, DoWork)

  case DoWork => 
     //do some work here
}

```
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.