Overview of Design Patterns in Java

Now, ComplexClass is given a particular Sortable implementation as a constructor argument. ComplexAlgorithm does not care what exact sorting algorithm is being used; it is happy that that object implements the sort() method of Sortable. When you rotate the knob of the fan control, the level changes, and this causes the speed of the fan […]