Tutorial by Examples

A real world example using a scientific experiment where certain routines are performed on different types of tissue. The class contains two functions by default to get the tissue or routine separately. In a later version we have then adapted it using a new class to add a function that gets both. Th...
Lets assume that in your current codebase, there exists MyLogger interface like so: interface MyLogger { void logMessage(String message); void logException(Throwable exception); } Lets say that you've created a few concrete implementations of these, such as MyFileLogger and MyConsol...
A great existing example of the Adapter pattern can be found in the SWT MouseListener and MouseAdapter classes. The MouseListener interface looks as follows: public interface MouseListener extends SWTEventListener { public void mouseDoubleClick(MouseEvent e); public void mouseDown(MouseE...
To make the use of the adapter pattern and the kind of situation when it may be applied more imaginable, a small, simple and very concrete example is given here. There will be no code in here, just UML and a description of the example situation and its problem. Admittedly, the UML content is writte...

Page 1 of 1