0
Завершено

Why need to create class instead of interface ?( Replace Method with Method Object.)

mahendrag gajera 8 лет назад обновлен anonymous 7 лет назад 2

Hello Sir,


A your suggestion i do agree with you create new class for very long method as u suggested.

In this case how do you write unit test?

Is it possible to create interface instead of calss ?

Please give explanation.


Ответ

Ответ
Завершено

Hey Mahendra,


Nice question! Here's what I think:

1. You need a class anyway, since you have to put the extracted method body somewhere. You can not put it inside interface, right?

2. You can always extract interface from a resulting class later (see Extract Interface refactoring).

Ответ
Завершено

Hey Mahendra,


Nice question! Here's what I think:

1. You need a class anyway, since you have to put the extracted method body somewhere. You can not put it inside interface, right?

2. You can always extract interface from a resulting class later (see Extract Interface refactoring).

Сервис поддержки клиентов работает на платформе UserEcho