Monday, December 14, 2015

MVP and MVVM Design

I am now at where the agile dev design process of developing a MVP and MVMM patterns libraries. But how to implement this as certain choices have un-intended consequences.

Such as what? The choice of what to bound generic types by for example.  In view models and models to be precise you could bound the generic type to the android class, Parceable.  Nothing wrong with it as the JVM junit test side of things on Android as the android.jar has the methods as stubs on the jvm junit testing side.

So what is the un-intented consequence?  Guess. You have to create ParceableTester to mock the Parceable class.

But, probably the pure POJOs folks will disagree, with the new Google strategy of having a test JVM Junit style android.jar with the test flavor in a project one can use Parceable in model objects in both MVP and MVVM as long as one remembers to construct a ParceableTest class to mock the Parceable class.

Not too bad as its only one small extra class.