1

I've seen many data binding frameworks, such as WPF, AngularJS(Javascript), JSTL(JSP). They are trying to separate UI and Data completely.

However, one main problem is that it adds complexity. Sometime, you have to write a lot of extra code (for example to extend a view class) just for one line of UI code.

In modern applications, there are many transition animations when changing one UI element from one state to another state. When use data binding framework, it seems not easy.

Are there any other cons of using a data binding framework?


For example, to set focus on a text input, so complex in AngularJS, See: How to set focus on input field?

Community
  • 1
  • 1
Zach
  • 5,715
  • 12
  • 47
  • 62
  • 1
    `it adds complexity` - compared to what? you should focus your question in one technology. WPF has nothing to do with Web technologies, except the declarative markup. – Federico Berasategui Apr 07 '14 at 01:12
  • 2
    It is pointless to evaluate a certain technology or framework without having a specific requirement. – voddy Apr 07 '14 at 02:26

1 Answers1

1

All of the following refers to the WPF.

You have to write a lot of extra code (for example to extend a view class) just for one line of UI code.

With regard to the WPF, this is rare situation, you can give an example?

There are many transition animations when changing one UI element from one state to another state.

In WPF since version .NET 3.5 appeared VisualStateManager:

The VisualStateManager enables you to specify states for a control, the appearance of a control when it is in a certain state, and when a control changes states.

His goal - is to define the application state, and each state to do an action, such as an animation. In this situation Binding is not used as such.

When use data binding framework, it seems not easy.

I do not think it's disadvantage. Data Binding needed as you mentioned: separate UI and Data completely. In fact, the whole MVVM pattern is based on a powerful technology as Data Binding. This feature allows you to create an abstract connection between Model and View via ViewModel. And the key word is Data, everywhere where there is work with the data, it is better to use Data Binding.

Binding allows you to do many interesting things, such as Validation, Converters and much more. It is typically used for Binding properties, and nothing more. To work with the UI using other features like VisualStateManager, Triggers, DataTriggers, etc. and it is not difficult when you use it to its destination, just need to get used to.

The only downside - is that Binding can be used for other purposes, such as use of the Converter when you can not do without it. And yes, at first it may seem unusual, but I do not think that this a drawback, the same can be said about other technologies.

Even as a drawback can be said about the performance. If you assign a value directly or via Binding, assigning a value directly will be faster. But I think that the advantages of Bindings allow not pay much attention to it.

Anatoliy Nikolaev
  • 22,370
  • 15
  • 69
  • 68