Why are interfaces necessary in MVP design pattern?

I am trying to understands MVP using Winforms.

I found this example. Why do UserModel and UserView need to implement the IUserModel and IUserView interfaces ?

8

Interfaces are required in good quality implementations of MVP for the same reason they are required in all good “OO” designs:

  1. They help reduce coupling
  2. They discourage inheritance (which further reduces coupling)
  3. Arguably most importantly, they simplify unit test writing

1

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *