What is an adapter class?

Naruto picture Naruto · Apr 16, 2012 · Viewed 53.7k times · Source

I googled and investigated, but I still need some clarification: Are an adapter class and a controller class similar? If not, in what way they do differ?

Kindly explain.

Answer

AlexR picture AlexR · Apr 16, 2012

Adapter is a pattern that provides default (often empty) implementation of interface or abstract class. For example MouseAdapter provides empty implementation of MouseListener interface. It is useful because very often you do not really use all methods declared by interface, so implementing the interface directly is very verbose.

Controller is a part of MVC - Model-View-Controller pattern. No direct relation with Adapter.