Android MVP doubts reliability

I am starting to implement the MVP pattern in an Android project, and I have some doubts as to where I should check the fields before performing any actions.

For example, if I need to send a form with three fields (name, email address, text). Should I check the fields in action, or should I send them to the Lead for verification?

I am not 100% sure if the connection with the leader should be only with the correct data that has already been verified or not.

+4
source share
4 answers

It really depends, my recommendation is this (and what I usually do):

  • , . : ( 7 ), ( )
  • ( -) , . : Username ( , , )

-, , .

+10

, , , , , .

, , , , .

+2

:

private Presenter mPrensenter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btn.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v) {
            mPrensenter.load(name,email,text);
        }
    });
}

@Override
public void onRightDataValidated(){

}

MainView Prensenter:

public interface MainView{
    void onRightDataValidated();
}

public interface Presenter{
    void load(String name,String email,String text);
}

Presenter, , MainView.onRightDataValidated , MVP github.

+1

, , . , , , , .! , , , , . - enter image description here

, isDetailFilledOut() - , true, false. true, , , , saveOrder , .

0

All Articles