Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is data binding a bad idea?

Tags:

Another discussion (we've been having a lot of them these days!) in our work is whether data binding is a bad idea or not.

Personally, I think it is a Bad Thing™.

My reasons are thrice:

  1. It circumvents my well architectured MVP framework - with databinding, the view communicates bi-directionally with a model. Ewww.

  2. It promotes hooking up view controls to datafields at design time. In my experience, this leads to vital code (binding column A to Field X) being obscure and hidden away in some designer file. IMO this code should be explicit and in-your-face, so that it is easy to modify and see what is going on, without having to use a clunky designer interface.

  3. Relating to Point #1 this direct binding makes it harder to isolate each component (view, model, controller/presenter) and unit-test.

The pros are that it is easy to set up, and you can take advantage of some nice features (validation etc) which come with the plumbing already done for you.

But for me, databinding becomes much more of a hindrance when dealing with a large data-centric application.

Any thoughts?

like image 693
Duncan Avatar asked Aug 21 '08 08:08

Duncan


People also ask

Should we use data binding?

Using data binding can lead to faster development times, faster execution times and more readable and maintained code. Android data binding generates binding classes at compile time for layouts.

Why is two-way data binding bad?

This is when making a seemingly simple change to a page takes two days and tons of things break. This is when you start churning developers, velocity slows down, and things get bad. This is two-way data binding hell. And it creeps up on you, slowly, over time, because at the start everything is actually faster.

What is the benefit of data binding?

Data Binding allows you to effortlessly communicate across views and data sources. This pattern is important for many Android designs, including model view ViewModel (MVVM), which is currently one of the most common Android architecture patterns.

Which is better view binding or data binding?

ViewBinding vs DataBindingThe main advantages of viewbinding are speed and efficiency. It has a shorter build time because it avoids the overhead and performance issues associated with DataBinding due to annotation processors affecting DataBinding's build time.


1 Answers

As we say in the UK, "It's Horses for courses"

First off all, I agree with you! But...

For enterprise level applications, then spending the extra time on the system architecture, modelling and standards will give you a robust and sustainable system.

But it will take longer to develop (or at least longer to get to an initial release) and this may not be appropriate for every system or every part of the system.

Sometimes you just need to "get it done and done quick". For internal applications, back office systems and maintenance applications that are rarely used or very dynamic (the spec's change often) then there is little justification in building the Rolls Royce solution for this. It's better to get the developer spending time on the CRITICAL part of the system.

What you have to avoid / prevent is using these "one click framework" solutions on the MISSION CRITICAL area's of the system where the big transaction rate area's and where data quality and integrity is critical. Spend quality time shaving the milliseconds off on the most heavily used area's on the system!!

like image 133
Guy Avatar answered Oct 13 '22 05:10

Guy