Live Binding with Automatic updates in XE3 (no need to call Notify() as in XE2)
Asked Answered
J

1

63

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.

Jann answered 30/9, 2012 at 3:49 Comment(6)
The observer design pattern has been integrated into FireMonkey and the VCL.Coalition
plus.google.com/101083836958121708461/posts/emo9qcm2vwoCoalition
plus.google.com/101083836958121708461/posts/h6HSZxQdvqYCoalition
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).Intimacy
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.Gujarati
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.Diagnose
I
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.

Inroad answered 5/6, 2013 at 20:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.