Aspect Adaptor

Could someone please provide an example of this?

The way to adapt to the behaviour of the ValueModel used in the ModelViewController (and ModelViewPresenter in DolphinSmalltalk). Say, you have a Person class with two accessors:

  Person>>name
    ^ name.
  Person>>name: aString
    name := aString.

The pair of accessors (name/name:) is called an aspect. You can treat an aspect as a ValueModel, passing it to UI elements expecting ValueModel. In MVP:

  |person adaptor|

person := Person new.

adaptor := person aspectValue: #name.

adaptor value: 'Mister One'.

TextPresenter showOn: adaptor.


EditText of this page (last edited May 27, 2004) or FindPage with title or text search