64

I am currently using Delphi XE2, and heard about their new Live Binding with Automatic updates in XE3 (no need to call Notify() as in XE2).

in C# or in Delphi XE2 we have to implement INotifyPropertyChanged (Notify(); in Delphi), and this approach really makes sense as we have full control over the contents to be updated and when to update it so we can fine tune the performance and implement virtualization easily.

But I just want to know how does it works, what kind of mechanism they have done in order to implement it, and i have no clue how they have did it, following are the assumptions may have used to implement Automatic updates.

  1. Timer : A timer tick frequently and refreshes all the data

    Very slow performance no virtualization

  2. Compiler Level Feature : All the notify() events related codes implemented by the compiler auto-magically

    Lots of over heads

  3. Somme other Approach:

Please help me to identified how they have implemented it.

I am currently using XE3 trial so i don't have access to the source code, your answers will help me decide whether to switch to new features or not.
I have a class(collection item) with 400 properties to bind(Not all of them all the time), so the performance really plays a major role in the stability of my application.

Vitor Canova
  • 3,778
  • 4
  • 27
  • 55
VibeeshanRC
  • 6,659
  • 8
  • 50
  • 97
  • 2
    The observer design pattern has been integrated into FireMonkey and the VCL. – LachlanG Sep 30 '12 at 12:25
  • https://plus.google.com/101083836958121708461/posts/emo9qcm2vwo – LachlanG Sep 30 '12 at 12:25
  • 1
    https://plus.google.com/101083836958121708461/posts/h6HSZxQdvqY – LachlanG Sep 30 '12 at 12:26
  • 3
    Afaik the automatic updates are only related to the controls you can bind to and there is no "magic" involved for any data objects when you change a property (you still have to call Notify in these cases). – Stefan Glienke Oct 01 '12 at 06:18
  • 2
    Not sure why you are asking this question. It's kind of vague what you want to know. Observer pattern is like regular delphi events but multi-listener. (Add self as observer, by calling method, passing a callback as a parameter). Not exactly complex in implementation and not inefficient at all. #1. No. #2. No. #3. Yes. Callbacks. Delegates. Lambdas. Closures. – Warren P May 28 '13 at 00:40
  • 1
    I'm interested in how it's implemented too, mostly because I wasn't aware of the feature at all. I have only used XE2's live bindings. At the time I thought it needed something like this. – David Jun 04 '13 at 11:22

1 Answers1

2

LiveBindings happen by binding any object with another object of interest based on some events. This happens by an observer pattern, when there is event trigger, the object inspector will be notified and the inspector will notify the already registered components to display the changes.

Hope this helps. There is lot of documentation for this if you want to dig around.

jamb
  • 176
  • 8