concept diagram in category functional programming

appears as: diagrams, diagram, diagrams
Grokking Functional Programming

This is an excerpt from Manning's book Grokking Functional Programming.

Calculating the score imperatively
public static int calculateScore(String word)  { #A
  int score = 0;
  for(char c : word.toCharArray()) {
    score++;
  }
  return score;
}

We designed the solution for our problem by coming up with the state fields and public interface methods. Warning! The design of ShoppingCart has some very serious problems! We will discuss them shortly. If you have already spotted them, good for you! If not, please keep thinking about all the possible ways this design and the code below may be misused.