concept case in category lift

This is an excerpt from Manning's book Lift in Action: The Simply Functional Web Framework for Scala.
Table 1.1. Comparing Java and Scala styles of coding
Java
Scala
When building class definitions, it’s common to have to build so-called getter and setter methods in order to set the values of that instance. This typically creates a lot of noise in the implementation (as seen in the Java example that follows). Scala combats this by using the case modifier to automatically provision standard functionality into the class definition. Given an instance of the Person case class, calling person.name would return the name value. public class Person {
private int _age;
private String _name;
public Person(String n, int a){
_age = a;
_name = n;
}
String name(){ return _name; }
int age(){ return _age; }
}case class Person(
name: String, age: Int)Most applications at some point have to deal with collections. The examples that follow create an initial list and then produce a new list instance that has the same animal names, but in lowercase. The Java example on the left creates a list of strings, then creates a second empty list, which then has its contents mutated by looping through the first list and calling toLowerCase() on each element. The Scala version achieves the exact same result by defining a function that should be executed on each element of the list. The Scala version is a lot more concise and does the exact same thing without the code noise. List<String> in = Arrays.asList(
"Dog", "Cat", "Fish");
List<String> out =
new ArrayList<String>();
for(String i : in){
out.add(i.toLowerCase());
}List("Dog","Cat","Fish")
.map(_.toLowerCase)
LiftRules.exceptionHandler.prepend { case (Props.RunModes.Production, _, exception) => RedirectResponse("/error") }
This setup is obviously far more complex and has many more moving parts than the single-server setup, but it could service a magnitude more traffic and be resilient in the case of failure. In the figure, the two frontend servers A and B include NGINX for HTTP decoding (SSL) and any facilities you may require, and HAProxy for load-balancing. These servers could feasibly be located in separate availability zones around the world, such as server A in west coast USA and server B in east coast USA.[1] Both frontend servers could dispatch to the bevy of backend servers, which, once again, could feasibly be distributed around the world. This would give you a scenario whereby you’d have near-zero downtime in the event of a failure, either at the ISP level or at the application server level. In the event of a Jetty server going down, HAProxy would simply route your request to one of the other available nodes, and in the event of a systemic failure at hosting location A, site B would continue service with limited capacity.