GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Contents
  • Current events
  • Random article
  • About Wikipedia
  • Contact us
  • Help
  • Learn to edit
  • Community portal
  • Recent changes
  • Upload file
  • Special pages
  • Search
  • Donate

This view

  • Original page
  • New address

GeezerVison is showing en.wikipedia.org — Binding properties pattern - Wikipedia

This article may be confusing or unclear to readers. Please help clarify the article. There might be a discussion about this on the talk page. (May 2017) (Learn how and when to remove this message)

The binding properties pattern is combining multiple observers to force properties in different objects to be synchronized or coordinated in some way. This pattern was first described as a technique by Victor Porton.[1][2] This pattern comes under concurrency patterns.

Comparison with aspect-oriented implementation

As an alternative to the aspect-oriented implementation of mutual properties, property binding can be proposed. In LibPropC++ C++ library it is implemented too.[3]

Some weakness in the LibPropC++ (with property binding):

  1. Its use is not transparent as it requires to be declared necessary object attributes as properties and appropriate accessor methods must be provided
  2. Binding of attributes in LibPropC++ is not designed to replace method calls
  3. The library does not maintain an interaction history.[3]

Implementation

There are two types of binding. One-way binding should be applied when one of the properties is read-only. In other cases, two-way binding must be applied.[2][3]

Infinite loops can be eliminated by blocking the signal, or comparing the assigned value with the property value before assignment, or eliminating unnecessary assignments.[2][3]

Binding properties of different types can be achieved through type conversions.[2][3]

Binding properties with transformations can be achieved through reducing the transformation function to the problem of binding properties, and the function can be imaginary consider as Type Conversions.[2][3]

Procedural programming
Object-oriented programming
Signals/event programming
Components with properties
binding properties together

[2]

Resulting context

Properties are being kept synchronized automatically. Between library calls they always have the values expressed by the EqualityConstraints.[3]

Deficiencies

Property changes watching mechanism acquires some resources.[3]

Sample code

Code sketch for one-way binding may look like as follows:

import java.util.Map;
import javafx.util.Pair;

void bindMultipleOneWay(Pair<X, Y> src, Map<X, Y> dst) {
    for (Map.Entry<X, Y> pair : dst.entrySet()) {
        bindPropertiesOneWay(src.getKey(), src.getValue(), pair.getKey(), pair.getValue());
    }
}

[2]

Two-way binding can be expressed as follows:

void bindTwoWay(X prop1, X prop2) {
    bind(prop1, prop2);
    bind(prop2, prop1);
}

[3]

Accomplishing the binding (i.e. connecting the property change notification in an event handler) may be like as follows:

void onPropertyChange(X src, X dst) {
    blockSignal(src, onPropertyChange);
    dst = src;
    unblockSignal(src, onPropertyChange);
}

[3]

See also

  • Software design pattern

References

  1. ↑ "Binding Properties". Cunningham & Cunningham. Cunningham & Cunningham. Retrieved 4 February 2015.
  2. 1 2 3 4 5 6 7 Porton, V. "Binding together Properties of Objects". Victor Porton. Retrieved 25 February 2021.
  3. 1 2 3 4 5 6 7 8 9 10 Evermann, J., The Association Construct in Conceptual Modelling - An Analysis Using the Bunge Ontological Model, Wellington, New Zealand: School of Information Management, Victoria University
Retrieved from "https://en.wikipedia.org/w/index.php?title=Binding_properties_pattern&oldid=1368546286"
Category:
  • Software design patterns
Hidden categories:
  • Wikipedia articles needing clarification from May 2017
  • All Wikipedia articles needing clarification
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.