Slide 1

Slide 1 text

@NYTDevs | developers.nytimes.com

Slide 2

Slide 2 text

@NYTDevs | developers.nytimes.com Project Phoenix ● Complete rewrite ○ code ○ design ● Leverage open source technologies (Picasso, Dagger, Robolectric) ● Bleeding edge (RxJava, Groovy)

Slide 3

Slide 3 text

@NYTDevs | developers.nytimes.com Code Structure ● Each reusable component is a separate repo. Gradle submodule an option too. ● Enforces modularization and provides clarity of dependencies. ● Tests ( unit/contract/security) run only for the module that has changed. ● Reactive Glue ( more on this later)

Slide 4

Slide 4 text

@NYTDevs | developers.nytimes.com RxJava ● Async data streams ● Create, chain and filter streams ● Error propagation ● Schedulers ( RxAndroid) ● Testing structures provided ○ ex: toBlocking

Slide 5

Slide 5 text

@NYTDevs | developers.nytimes.com RxJava by example networkManager.getData(source) .flatMap({ new FeedParser().getMovies(it) }) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ Movies m -> movies.clear(); movies.addAll(m.movies); notifyDataSetChanged(); }, { Throwable e -> Toast.makeText(context,"Download failed: " + e.getMessage(),Toast.LENGTH_SHORT) .show(); }, { Log.d(this.getClass().getName(), "complete happened"); });

Slide 6

Slide 6 text

@NYTDevs | developers.nytimes.com Reactive Glue - RxJava ● Modules talk in terms of Observables ● Promotes Async contracts ● Tricky to wrap your head around non- blocking/async programming ○ easier for mobile due to inherent async behavior

Slide 7

Slide 7 text

@NYTDevs | developers.nytimes.com Thundering herd ● Subjects becomes gatekeeper ● Return subject and emit values to all awaiting clients ● Protect your server from self inflicted DDoS

Slide 8

Slide 8 text

@NYTDevs | developers.nytimes.com Groovy Func0 func = new Func0() { @Override public String call() { return "my content"; } }; Async.start(func); With closures it becomes: Async.start({ return “my content” })

Slide 9

Slide 9 text

@NYTDevs | developers.nytimes.com Groovy Challenges ● Method number ( Dex limit hit more easily) ● Hard to debug ● Reliance on reflection leads to potential slowness ● Jack & Jill ● Code obfuscation ( reflection complicates things)

Slide 10

Slide 10 text

@NYTDevs | developers.nytimes.com Other Challenges ● Rewrite happening while Android tooling and Groovy in beta. ● Dagger 1.0 to 2.0 forced upgrade due to code obfuscation problem

Slide 11

Slide 11 text

@NYTDevs | developers.nytimes.com Leveraging Server side- Samizdat ● Scala - Finagle ● Content transformations ● Streamlined auth ● API centralization

Slide 12

Slide 12 text

We’re hiring nytimes.com/careers @NYTDevs | developers.nytimes.com