Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Increase productivity using Design patterns, Li...

Viraj Tank
November 03, 2016

Increase productivity using Design patterns, Libraries & Tools

Viraj Tank

November 03, 2016
Tweet

More Decks by Viraj Tank

Other Decks in Technology

Transcript

  1. MVP View <=> Presenter Presenter + Subscriptions Presenter + Error

    handling MVVM View => ViewModel View + Subscriptions View + Error handling Reusable ViewModel 1 Presenter 1 View Behavioral Design Patterns
  2. Binding TextView helloWorldText = (TextView) findViewById(R.id.hello_world_text); Button button = (Button)

    findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { /* Some Logic */ } });
  3. Data Binding <layout> <data> <variable name="user" type="com.example.User"/> </data> <LinearLayout> <TextView

    android:text="@{user.firstName}"/> <EditText android:text="@={user.firstName}"/> </LinearLayout> </layout> MainActivityBinding binding = DataBindingUtil .setContentView(this, R.layout.main_activity); User user = new User("Test", "User"); binding.setUser(user);
  4. Data Binding private static class User extends BaseObservable { private

    String firstName; @Bindable public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; notifyPropertyChanged(BR.firstName); } }
  5. Cache HashMap Simple Minimal usage Smaller size Boilerplate code Guava

    Reactive Cache Powerful Data expiry Upper cap on size Massive library Powerful Data expiry Upper cap on size RxJava
  6. Database SQLite Battle tested 0 Method counts Relational DB Boilerplate

    code ORM/Helper Realm Simple & Useful Still SQLite Mega Fast No SQL Easy !(Boilerplate code)
  7. Hugo @DebugLog public String getName(String first, String last) { /*

    CODE */ return first + " " + last; } V/Example: ⇢ getName(first="Viraj", last="Tank") V/Example: ⇠ getName [16ms] = "Viraj Tank"
  8. RxJava - github.com/ReactiveX/RxJava ButterKnife - github.com/JakeWharton/butterknife RxBinding - github.com/JakeWharton/RxBinding DataBinding

    - developer.android.com/topic/libraries/data-binding/index.html Guava - github.com/google/guava ReactiveCache - github.com/VictorAlbertos/ReactiveCache Realm - realm.io Retrofit - github.com/square/retrofit Volley - developer.android.com/training/volley/index.html Infer - github.com/facebook/infer LeakCanary - github.com/square/leakcanary Crashlytics - fabric.io/kits/android/crashlytics Hugo - github.com/JakeWharton/hugo Setho - http://facebook.github.io/stetho/ Dryrun - github.com/cesarferreira/dryrun Methodscount - http://www.methodscount.com/