concept possibility in category machine learning

This is an excerpt from Manning's book Machine Learning Systems: Designs that scale.
Listing 2.2. Handling no votes using pattern matching
def getVotes(howler: String) = { #1 totalVotes.get(howler) match { #2 case Some(votes) => votes case None => 0 } } val nomNomVotes: Int = getVotes("nom nom") #3 val indianaVotes: Int = getVotes("Indiana") #4 #1 A function that handles the possibility that no one may have voted for a given dog yet #2 A pattern-match expression to handle the two possibilities #3 Returns 105 #4 Returns 0 !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":53},{\"line\":0,\"ch\":55}],[{\"line\":10,\"ch\":0},{\"line\":10,\"ch\":2}],[{\"line\":1,\"ch\":53},{\"line\":1,\"ch\":55}],[{\"line\":11,\"ch\":0},{\"line\":11,\"ch\":2}],[{\"line\":7,\"ch\":53},{\"line\":7,\"ch\":55}],[{\"line\":12,\"ch\":0},{\"line\":12,\"ch\":2}],[{\"line\":8,\"ch\":53},{\"line\":8,\"ch\":55}],[{\"line\":13,\"ch\":0},{\"line\":13,\"ch\":2}]]"} !@%STYLE%@!
This trivial example demonstrates Scala’s concept of an Option type. In this example, the language will allow you to pass any string key to the map of votes, but it doesn’t know whether anyone has voted for nom nom until executing the lookup. Option types can be viewed as a way of encoding the intrinsic uncertainty in an operation. They close over the possibility that a given operation may return a value, Some of a given type, or None.
Separating the definition of an action from the execution of that action is often a helpful idiom. In this case, it helps you encode that the insertion both is going to take time and could possibly fail. For example, you could replace the failure case in the pattern match with retry logic or some meaningful notification. Recognizing and encoding the possibility of failure is a key step toward building resilience into a system.
Futures-based programming handles the possibility that operations can take time and even fail.