In this talk, we’ll show you our development process at Infinum. We'll talk about Continuous integration, MVP, Git flow, static code analysis, Unit tests, multi-environment support and a few more.
21. MVP
• a derivative from MVC
• Models and Views never communicate directly
Model Presenter View
22. View
• Activity, Fragment, View
• propagates UI events to presenter
• exposes methods that control presentation of data
Model Presenter View
23. Presenter
• middle man between View and Model
• updates the UI - difference to MVC
Presenter ViewModel Presenter
• Activity, Fragment, View
• propagates UI events to presenter
• exposes methods that control presentation of data
View
29. Dependency injection
• Dagger 2
• https://github.com/reisub/Dagger-2-Example
• simplifies writing tests
• Model / View / Presenter can easily be replaced
30. Without DI
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
//dependencies
loginPresenter = new LoginPresenterImpl(this, new LoginModelImpl());
}
LoginView LoginPresenter LoginModel
LoginActivity LoginPresenterImpl LoginModelImpl
31. With DI
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
//dependencies
DaggerLoginComponent.builder()
.loginModule(new LoginModule(this))
.build()
.inject(this);
}
32. With DI
• decoupling dependencies from implementation
• easier to replace dependencies
• more about Dagger:
http://google.github.io/dagger/
33. Robolectric
• mock Android VM (tests run on desktop machine)
• View doesn’t have to be mocked
• full control of Activity / Fragment lifecycle
• http://robolectric.org/
34. MockWebServer
• part of OkHttp library
• server that runs on localhost
• responses can be enqueued
• https://github.com/square/okhttp/tree/master/
mockwebserver
35. Mocking network layer
• network layer can be replaced with MockWebServer
• no additional mock classes
37. Idea
• commit to a branch starts test execution
• CI server clones the repo, compiles and runs tests
• test results are archived and notified via mail / chat
38. CI servers
• Jenkins
• Travis
• Circle CI
• https://circleci.com/
• works only with GitHub
45. Infinum Labs
• internal app store
• gradle task increments version name
• upload app via web, CLI tool or AS plugin
• library that notifies when new version is available
51. Releasing and analytics
• internal store for clients
• automatic notification when new version is up
• analytics / crashlytics
52. • initial project setup takes more time
• steeper learning and onboarding curve
• developing new features initially takes more time to
cover the code with unit test
Cons
53. • confidence in builds
(so much that we believe we’re Navy Seals)
• more maintainable code
• regression testing
Pros
54. Implementation Testing Release Post Release
Architecture
Build Types
MVP
Dependency
injection
Unit Tests
Robolectric
MockWebServer
Manual tests
Human tester
Infinum
Notifier lib
Analytics
Google analytics
Crashlytics
Play Store