Scala extends the idea of interfaces introducing traits. A trait is something in between an interface, because it states the nature of methods and even fields, and a full superclass, since a trait can also implement methods and fields.

Traits are Scala answer to the multiple inheritance problem. Other languages like C++ allow a class to inherit from multiple classes. When two or more superclasses declare the same method, the subclass is forced to reimplement that method to clarify what it does. Java on the other hand excludes multiple inheritance to avoid this kind of complexities. A Java class can only extend one single superclass. Scala keeps this restriction (a class extends only one superclass) but mitigate the drawbacks by allowing the subclass to mix in as many traits it needs.

Suppose you have used a web resource for a while accessing it by IP address. Let's say the URL was Suppose the resource required you to enter a password, something you set up long long time ago and don't remember, but something your browser remembers in its password store for you. Now suppose the resource has moved to another URL: Your browser does not fill the password any longer, since it's not bound to the new URL, and of course you don't remember it. The only option left is using the password recover procedure, if available, or contact the service administrator.

But wait! Let's try to look at the problem in another way.

What's the first action you take when a log says: no space left on device? Mine is:

$ df -h /mount/point

Well, quite surprisingly at first, a filesystem can be full even when there's still plenty of space on it. Is something that rarely happened to me, so rarely that I usually don't check the other side of the coin: free inodes!

Peano axioms are the foundation of modern mathematics. The five rules that bring its name define the concept of ordered set of numbers. The axioms are:

  1. 0 is a number
  2. the successor of a number is a number
  3. two different numbers can't have the same successor
  4. 0 is not the successor of any other number
  5. every property of 0 or of any successor of a number which has that property, if a property of every number

Peano axioms was intended to describe natural numbers: 0, 1, 2, 3, 4, 5, ... But the idea of successor is open to a wide range of interpretations. Bertrand Russel writes in its Introduction to Mathematical Philosophy that if we take the notion of pair number and we use it to define what is the successor of a number, Peano axioms still hold: 0, 2, 4, 6, 8, ...

This idea can be elegantly formalized in Scala by defining a successor function for a specific number series:

  The Cog In The Machine On Which All Depends