concept water container in category software development

appears as: water containers, water containers, water container
Seriously Good Software: Code that works, survives, and wins

This is an excerpt from Manning's book Seriously Good Software: Code that works, survives, and wins.

The core idea of this book is to convey the mindset of an experienced developer by comparing and contrasting different code qualities (aka nonfunctional requirements). Most of these qualities—like performance or readability—are universal, in the sense that they’re relevant to any piece of software. To emphasize this fact, you’ll revisit the same recurring example in each chapter: a simple class representing a system of water containers.

Instead of people, you’ll deal with a set of water containers, all identical and equipped with a virtually unlimited capacity. At any given time, a container holds a certain amount of liquid, and any two containers can be permanently connected by a pipe. Instead of sending messages, you can pour water in or remove it from a container. Whenever two or more containers are connected, they become communicating vessels, and from that time on they split equally the liquid contained in them.

Listing 7.1. Readable: The class header
/**  #1 Beginning of a Javadoc comment
 *  A <code>Container</code> represents a water container
 *  with virtually unlimited capacity.
 *  <p>    #2 Most HTML tags are allowed.
 *  Water can be added or removed.
 *  Two containers can be connected with a permanent pipe.
 *  When two containers are connected, directly or indirectly,
 *  they become communicating vessels, and water will distribute
 *  equally among all of them.
 *  <p>
 *  The set of all containers connected to this one is called the
 *  <i>group</i> of this container.
 *
 *  @author Marco Faella   #3 Javadoc tag
 *  @version 1.0           #4 Another Javadoc tag
 */
public class Container {
   private Set<Container> group;
   private double amount;


!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":7}],[{\"line\":3,\"ch\":11},{\"line\":3,\"ch\":13}],[{\"line\":13,\"ch\":27},{\"line\":13,\"ch\":29}],[{\"line\":14,\"ch\":27},{\"line\":14,\"ch\":29}]]"}
!@%STYLE%@!