View-Bridge-Mediator in Android
In this blog series I'll be sharing the process of developing an app that utilizes a lot of technologies, practices, and patterns that I find critical to producing high quality, maintainable code.
The big part; if not obvious, is to demonstrate the development and use of the View-Bridge-Mediator pattern for the UI layer. This is the goal of the whole series; to show a way to implement VBM on Android. In addition, using TDD to develop the code; and allowing emergent design. This applies to VBM as well. It is an emergent design I like from doing TDD with an eye towards MVVM. As the View-Bridge-Mediator post covers, I'm not a fan of MVVM.
In addition to TDD and emergent design; I'll have a focus on integration tests. This will allow end to end testing of the app with known data.
The next step in testing is functional tests; which I'll demonstrate with Appium. I think Espresso and the Android Instrumentation tests are great, but they seem more whitebox functional tests; and I'm a fan of blackbox functional testing. I think both have a place, but the behavior of the app is of more value in testing than having tests around every little piece that ends up tightly coupled to the implementation.
Over all, this series is going to demonstrate technologies and how they can be applied to produce a solid Android app. The app we will build is to view HackerNews. This will be a simple app; show top stories, tap to view comments; and that's really all it's aiming to be. Other things might slip in; who knows. I don't really plan out the details of these series; Just a high level and then I run with it.
Currently I have this broken down into a number of posts. A lot of them are related to specific technologies I find great for producing software. This order isn't static; I expect it'll be pretty close to what I end up with; but I'm not going to hold tight to it if I find value in deviation.
There's this post; laying out the overview of the series and what I hope to cover and accomplish.
The first part in the series will cover using Retrofit as the networking layer. I've found it hugely valuable in my work and it simplifies a lot of the drudgery involved with network calls.
The second part will extend the app to include a simple UI which will allow us to implement integration tests. I expect this to be a pretty quick app; but having functional tests in place early in the app will give us a lot of assurance of what we do in the app isn't breaking anything else.
Part three will introduce Appium and running it locally.
The next post; part four; once we have our functional and integration tests available; will be to start building the app! We'll implement the Top Stories activity using TDD and see how the View-Bridge-Mediator emerges from TDD and Object Oriented Design.
Once the UI is available and doing a little bit; we'll focus more on fleshing out the happy path and get it well tested. This "Happy path" work will be in part five.
Of course the happy path isn't the only path; part six will be the work around errors in the app. This is going to exemplify the value in integration tests and being able to fake network responses.
While it will encompass a lot of work; part seven will be the whole of adding the story/comment activity. While it will involve the same types of work broken out into individual posts for the Stories activity; that depth of a write up won't be required for the additional screen.
Going through this process, the integration and functional tests will be worked on; but an additional part at the end to go back over the work done for functional tests in Appium, lessons learned and patterns evolved should provide some informative points on the use of Appium. This will be part eight of the series.
Part nine will be a summary post with any closing thoughts.
Depending on if I get to it, or find it useful on it's own; I'd like to do an additional part on setting up and running CI/CD for the app. This would showcase running unit, integration, and functional tests.
If more things show up; sure, I'll tack them in as well. This is the high level outline of the work I'd like to have showcased supporting the implementation of the View-Bridge-Mediator pattern on android.