How to unit test Kotlin suspending functions

I’ve found out that it’s because of a CoroutineDispatcher. I used to mock UI context with EmptyCoroutineContext. Switching to Unconfined has solved the problem Update 02.04.20 The name of the question suggests that there’ll be an exhaustive explanation how to unit test a suspending function. So let me explain a bit more. The main problem … Read more

In MVP where to write validations

Domain specific rules/validations should be in the Model. You can have a model.validate() to let you know if the rules are not violated. Look at Rails model (ActiveRecord) classes for a good implementation of this concept. The View should make it difficult for the user to key in invalid input. So ‘entering a string for … Read more

What Alternatives Are There to Model-View-Controller? [closed]

Passive View – http://martinfowler.com/eaaDev/PassiveScreen.html Supervising Controller – http://martinfowler.com/eaaDev/SupervisingPresenter.html Model-View-Presenter – http://martinfowler.com/eaaDev/ModelViewPresenter.html My personal favorite is the Passive View. More testable than others I’ve seen including MVC.

Android MVP – Should avoid using R.string references in presenter?

I consider that there’s no reason to call any android code in Presenter (But you always can do it). So in your case: View / activity onCreate() calls -> presenter.onCreate(); Presenter onCreate() calls -> view.setTextLabel() or whatever you want in the view. Always decouple Android SDK from presenters. In Github, you can find some examples … Read more

MVP for Activity with multiple Fragments

The activity/fragments should be considered as just the view in the MVP model. This means that they should just show data and receive user interactions. It is ok to communicate activity and fragments via interface/callbacks. But, it is not an activity/fragment responsibility to call the API services. The presenter should be responsible to call the … Read more

What to use? MVC, MVP or MVVM or…?

Actually, the ultimate post you’re looking for is this answer this answer from Karsten Lentzsch (of JGoodies fame) in the Swing Frameworks and Best Practices Swing Frameworks and Best Practices thread. Hello, I’ve been writing Swing apps for several years that many people find elegant. And I teach developers in working with Swing efficiently: how … Read more

MVP examples for Windows Forms

Jeremy Miller’s “Build your own CAB” series is fantastic. You get a nice dose of MVP (along with some other smart client patterns such as Pub/Sub). http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx

tech