📜 ⬆️ ⬇️

Droidcon London. How it was



The other day in London, the droidcon conference took place. She was not spared such fashionable themes as Redux, MVI, the optimization of assembly speed and the possibility of Gradle. The event was opened by a report by Chet Haase and Romain Guy about the fragmentation of memory and differences between the Android version of the Garbage Collector, and Jake Wharton made a presentation about Dagger.

In this review I want to share my impressions of the conference and the details of these reports.
')
I heard a lot about the London droidcon, but so far I have not been able to attend it, as it is much more expensive than, for example, the droidcon Berlin, not to mention Moscow conferences. At the same time, the level of Russian conferences, such as droidcon, Mobius, AppsConf, has greatly increased in recent years, and I wanted to compare the atmosphere, the level of organization and reports with foreign analogues.

But first things first.


Tickets


If you buy a ticket in advance, you can take it for 230 pounds + VAT. The final price was about 700 pounds, including VAT. Quite expensive when compared with tickets to Russian conferences, but on average for Europe this is an adequate price. The flight will cost about 30 thousand rubles, but there is an opportunity to save money, since Victory is flying there now, and you can buy a ticket for about 6000 rubles one way.


Accommodation


We lived in a 15-minute walk from the venue. Hotel average, about 150 pounds per day. In fact, if you are not too demanding, then you can live in a hostel in the city center for 20 pounds a day.




Organization

In terms of organization, the conference was at a fairly high level. I liked the playground itself: a spacious hall for communication and moral relaxation, comfortable audiences in which reports were read. In the lobby there were many stands of various companies where you could take a pair of pens and t-shirts. In the evening of the first day, the organizers organized a party. There were free drinks and music, we went for a walk around London.






Reports

The schedule, in my opinion, was drawn up very well, since at any time there were interesting reports. In addition, workshops were constantly held.


But from the level of reports I expected more. Many of them were without any practical component, for example, just a description of some API or functionality. The level of reports at Moscow conferences is at least not lower. There were some pretty strong and relevant speeches. Next, I will write about those that seemed to me the most interesting.


More about reports

Keynote - Trash Talk: The Evolution of Garbage Collection on Android
Chet Haase and Romain Guy, Google
The conference began with a very good report on the model of memory in Android. The guys told how it changed from version to version, for what reasons it happened. I will not disclose the details here, but I recommend viewing the video .

Modularization - How Hard Can It Be?
Elin Nilsson, Spotify
Not exactly technical, but more motivational, but no less interesting report. Elin spoke about the reasons that made them think about dividing a monolithic application into modules, how hard it went and what came of it in terms of the amount of code, processes and build speed. Link to the report .



Redux on Android
Nish Tahir, WillowTree
I will not say that this report somehow opened my eyes to Redux, but, in my opinion, the author well revealed the essence of this decision, spoke about the problems and whether Redux should be chosen as the main architectural pattern and in which cases it is justified. Link to the report



Modern data binding
Yigit Boyar and Jose Alserek (Yigit Boyar and Jose Alcerreca), Google
It was interesting to hear a report about the tools from Google from the mouths of the developers themselves. In principle, they didn’t say anything new, the desire to use Data Binding didn’t appear either, but thanks for the attempt. Link to the report

Deep Dive into the Android Gradle Plugin
John Rodriguez, Square Cash
This report was one of the last at the conference, and I was no longer ready to accept interesting and informative information, but then John came out and made a good and rather hardcore report about interesting nuances of Android Gradle Plugin. I also recommend it for viewing .

Helping Dagger Help You
Jake Wharton, Google
A good report was from Jack Wharton. Together with Square, they made several convenient libraries for use with Dagger, which solve a number of developer problems.

First, a lot of attention is now being paid to the problem of assembly speed. This is especially true for Dagger and ButterKnife, as they use the annotation processor and kapt. Square presented a solution in which Dagger and ButterKnife implementations work on reflection instead of code generation. This slightly reduces the speed of the runtime application, but it saves time on compile time, and within the dev-builds it is quite justified, since for the latest Pixel and Samsung models this is barely perceptible work.


This is how Binder implementations look in the ButterKnife version with reflection
@NonNull @UiThread public static Unbinder bind(@NonNull Object target, @NonNull View source) { List<Unbinder> unbinders = new ArrayList<>(); Class<?> targetClass = target.getClass(); if ((targetClass.getModifiers() & PRIVATE) != 0) { throw new IllegalArgumentException(targetClass.getName() + " must not be private."); } while (true) { for (Field field : targetClass.getDeclaredFields()) { int unbinderStartingSize = unbinders.size(); Unbinder unbinder; unbinder = parseBindView(target, field, source); if (unbinder != null) unbinders.add(unbinder); unbinder = parseBindViews(target, field, source); if (unbinder != null) unbinders.add(unbinder); unbinder = parseBindDrawable(target, field, source); if (unbinder != null) unbinders.add(unbinder); unbinder = parseBindString(target, field, source); if (unbinder != null) unbinders.add(unbinder); ... } for (Method method : targetClass.getDeclaredMethods()) { Unbinder unbinder; unbinder = parseOnCheckedChanged(target, method, source); if (unbinder != null) unbinders.add(unbinder); unbinder = parseOnClick(target, method, source); if (unbinder != null) unbinders.add(unbinder); ... } targetClass = targetClass.getSuperclass(); } return new CompositeUnbinder(unbinders); } 

A library for ButterKnife can be found at this link. The version for Dagger is around here .


Secondly, sometimes it becomes necessary to inject dependencies into custom views that are declared in XML. Previously, you had to inject them through set-methods and throw them through classes from the outside, for example, in a presenter, when he attaches to the view. Now there is a convenient way to do this: dependencies can be prokidyd through the constructor immediately after the required parameters, and the custom LayoutInfater can create a twist with these complex constructors.


How it looks in code:


MainActivity.java
 public final class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainComponent component = DaggerMainActivity_MainComponent.create(); InflationInjectFactory factory = component.getInjectFactory(); getLayoutInflater().setFactory(factory); setContentView(R.layout.main_activity); GalleryPresenter presenter = component.getGalleryPresenter(); GalleryView view = findViewById(R.id.gallery); presenter.attach(view); } @Component(modules = ViewModule.class) interface MainComponent { InflationInjectFactory getInjectFactory(); GalleryPresenter getGalleryPresenter(); } } 

GalleryView is written in xml.


Galleryview
 public final class GalleryView extends LinearLayout { private final ViewUpdater mViewUpdater; @InflationInject public GalleryView(@Assisted Context context, @Assisted AttributeSet attrs, ViewUpdater viewUpdater) { super(context, attrs); mViewUpdater = viewUpdater; } } 

Thirdly, in Square, they approached in their own way the problem that AutoValue solves, namely the creation of factories for classes with heavy designers. Only this solution is maximally integrated into the Dagger logic.


Usage example:


UserPresenter.java
 public final class UserPresenter { private final LoadUserInteractor mLoadUserInteractor; private final String mUserId; @AssistedInject UserPresenter(@Assisted LoadUserInteractor loadUserInteractor, @Exclamation String userid) { mLoadUserInteractor = loadUserInteractor; mUserId = userid; } @AssistedInject.Factory public interface Factory { UserPresenter create(String greeting); } ... } 

UserActivity.java
 public final class UserActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_view); UserPresenter.Factory factory = DaggerUserActivity_ UserComponent.create().getUserPresenterFctory(); UserPresenter presenter = factory.create(getIntent().getStringExtra("user_id")); presenter.attach(); ... } @Component(modules = UserModule.class) interface UserComponent { UserPresenter.Factory getUserPresenterFctory(); } } 

I liked how easy these implementations look like. I also advise to view .


Undoubtedly, I learned something interesting for myself from the reports of the conference, talked with colleagues from different companies, which is a great advantage of an international conference, and it is for the sake of networking that you should go for them. As a bonus, this time was a visit to London. If we talk about reports, it is easier to watch them online or attend one of the many Russian conferences.

Source: https://habr.com/ru/post/428562/


All Articles