Share
Embed
Unconventional Android v2
Android presentation given at Boise Code Camp 2015.
To get the most out of this presentation, follow along with the tags on GitHub: https://github.com/codeprogression/bcc-android-2015
Richard Cirerol
March 21, 2015
Transcript
46 slides
-
Welcome to Unconventional Android version 2. Why V2? Well, I
gave a similar talk last year. I updated it and rev'd it for you. So if you saw my talk last year, don't fret - I have a bunch of new content here. Unconventional Android v2 | Richard Cirerol | @codeprogression -
I work for a company in the San Francisco Bay
Area called Vertigo. Vertigo is a really cool place to work. I get to write Android applications for some pretty high-profile clients. Unconventional Android v2 | Richard Cirerol | @codeprogression -
We've done apps for NBC Universal (SyFy, USA, and other
networks), Microsoft, Radio Disney, GoPro, HBO, Google and more. In addition to Android, we do apps for iOS, Windows, Windows Phone, XBox, Playstation, Roku, and we even do websites. Unconventional Android v2 | Richard Cirerol | @codeprogression -
(psst! we're hiring!) Oh! Did I mention we are always
looking for developers and designers? And we are a primarily-remote workforce. Unconventional Android v2 | Richard Cirerol | @codeprogression -
DEMO Tags: - 01_start: Get a list of movies -
02_grid_layout: Grid w/ poster art (bad perf) - 03_picasso: Use picasso - 04_detail: Update detail page Unconventional Android v2 | Richard Cirerol | @codeprogression -
The Three Terrors of the Fire Swamp Unfortunately, we've wandered
right into the Fire Swamp Unconventional Android v2 | Richard Cirerol | @codeprogression -
Three Terrors Bloat Cancerous State Asynchronicity Unconventional Android v2 |
Richard Cirerol | @codeprogression -
Three Terrors Bloat In the main activity, we can't see
at a glance what is happening because we are doing too many things here. Same thing with our MovieActivity and Movie View Holder. We have repeated code and misplaced code. How do we tackle bloat? Unconventional Android v2 | Richard Cirerol | @codeprogression -
The SOLID and DRY Principles Unconventional Android v2 | Richard
Cirerol | @codeprogression -
The SOLID Principles 4 Single Responsibility 4 Open-Closed 4 Liskov
Substitution 4 Interface Segregation 4 Dependency Inversion Unconventional Android v2 | Richard Cirerol | @codeprogression -
The DRY Principle Don't Repeat Yourself Unconventional Android v2 |
Richard Cirerol | @codeprogression -
DEMO Applying Clean Code Principles Tags: - 05_refactor: Move poster
uri generation - 06_custom_view: Create custom views Using some clean code principles, we've made the code easier to read and componentized. Unconventional Android v2 | Richard Cirerol | @codeprogression -
Three Terrors Cancerous State Unconventional Android v2 | Richard Cirerol
| @codeprogression -
Are singletons bad? I don't think singletons are bad. But,
I do think they should be scoped and their accessors limited. Unconventional Android v2 | Richard Cirerol | @codeprogression -
Dependency Injection Dagger 4 http://square.github.io/dagger/ 4 http://github.com/square/dagger Unconventional Android v2
| Richard Cirerol | @codeprogression -
Dependency Injection From "Managing Your App's Memory" 1 1 http://developer.android.com/training/articles/memory.html
Unconventional Android v2 | Richard Cirerol | @codeprogression -
Now you may have heard that Google advises against dependency
injection on Android. But... Unconventional Android v2 | Richard Cirerol | @codeprogression -
Dependency Injection Dagger 2 4 http://github.com/google/dagger 4 http://google.github.io/dagger/ ...they are
actively developing Dagger 2 for use in Android as well as server projects Unconventional Android v2 | Richard Cirerol | @codeprogression -
Dagger 1 still has reflection components Dagger 2 is 100%
code generation Unconventional Android v2 | Richard Cirerol | @codeprogression -
DEMO Implementing Dagger 2 Tags: - 07_dagger Unconventional Android v2
| Richard Cirerol | @codeprogression -
Three Terrors Asynchronicity Thread - Handler - Message - Bus
AsyncTask - Intent Service - Callbacks So many ways to handle asynchronicity. They all have their place and they all have their drawbacks. Unconventional Android v2 | Richard Cirerol | @codeprogression -
Functional Reactive Programming Over the last couple years, functional reactive
programming has been coming into its own. You may know this better as... Unconventional Android v2 | Richard Cirerol | @codeprogression -
Functional Reactive Programming Reactive Extensions Reactive Extensions and Android has
its own version called... Unconventional Android v2 | Richard Cirerol | @codeprogression -
Functional Reactive Programming RxAndroid https://github.com/ReactiveX/RxAndroid RxAndroid - which is an
extension of RxJava that has some Android-specific APIs Unconventional Android v2 | Richard Cirerol | @codeprogression -
Working with HTTP in Android 4 AndroidHttpClient (DEPRECATED) 4 DefaultHttpClient
(DEPRECATED) 4 UrlConnection 4 OkHttp Unconventional Android v2 | Richard Cirerol | @codeprogression -
OkHttp A replacement for UrlConnection 4 https://github.com/square/okhttp Unconventional Android v2
| Richard Cirerol | @codeprogression -
DEMO Using RxAndroid and OkHttp Tags: - 08_okhttp - 09_rx
Unconventional Android v2 | Richard Cirerol | @codeprogression -
The Pit of Despair https://www.youtube.com/watch?v=BbgyppGqBgg Unconventional Android v2 | Richard
Cirerol | @codeprogression -
The Pit of Despair Boilerplate Code Unconventional Android v2 |
Richard Cirerol | @codeprogression -
Boilerplate Code 4 Sucks away at your life Unconventional Android
v2 | Richard Cirerol | @codeprogression -
Boilerplate Code 4 Sucks away at your life 4 Impedes
readability Unconventional Android v2 | Richard Cirerol | @codeprogression -
Boilerplate Code 4 Sucks away at your life 4 Impedes
readability 4 Obscures intention Unconventional Android v2 | Richard Cirerol | @codeprogression -
Views Butterknife 4 http://github.com/jakewharton/butterknife @InjectView(R.id.poster) ImageView poster; Butterknife.inject(this); Unconventional Android
v2 | Richard Cirerol | @codeprogression -
Extras Android Dart 4 https://github.com/f2prateek/dart @InjectExtra("id") int id; Dart.inject(this); Unconventional
Android v2 | Richard Cirerol | @codeprogression -
Accessors, etc Lombok 4 http://projectlombok.org/features/index.html 4 https://github.com/rzwitserloot/lombok @Getter, @Setter, @ToString,
... Unconventional Android v2 | Richard Cirerol | @codeprogression -
Parcel Parceler 4 http://parceler.org 4 https://github.com/johncarl81/parceler @Parcel Parcels.wrap(object); Parcels.unwrap(parcelable) Unconventional
Android v2 | Richard Cirerol | @codeprogression -
Logging Timber 4 http://github.com/jakewharton/timber Timber.d("An error occurred", e); Unconventional Android
v2 | Richard Cirerol | @codeprogression -
API Access Retrofit 4 http://github.com/square/retrofit 4 http://square.github.io/retrofit @GET("/configuration") public Observable<Configuration>
getConfiguration() Unconventional Android v2 | Richard Cirerol | @codeprogression -
DEMO Removing Boilerplate Code Tags: - 10_inject: Butterknife and Dart
- 11_codegen: Lombok, Parceler Unconventional Android v2 | Richard Cirerol | @codeprogression -
Vertigo is always looking for the best and brightest! Unconventional
Android v2 | Richard Cirerol | @codeprogression