Adding presentation logic on the layout.

<TextView
android:text="@{user.lastName}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{user.isAdult ? View.VISIBLE : View.GONE}"/>

Instead of android:visibility = …long logic..

you can probably set it to a simple property of the View Model, and keep the logic in the View Model. For example:

<TextView
android:text="@{user.lastName}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{user.isVisibile}"/>

Add Lambda expressions on the listeners.

Same argument right? We can keep the layout(XML) really simple ?

For example

android:onLongClick="@{handler.onLongClick}"

Despite the fact that Android Data Binding library allows, I wouldn’t put any logic in the layout, only properties of the View Model. Like you, I prefer to keep logic in the code.

Finally

I can develop things faster

Sorry, this is where I should agree with you but I have to beg to differ. For me it seems like it takes more effort to get all the setups completed. Especially with the current state of Android Studio, it seems to take longer.

Other than that I agree with you about other points such as Unit Testing.

Written by

Driven by passion and patience. Read my shorter posts https://dev.to/codeprototype (possibly duplicated from here but not always)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store