I have been doing OOP for a quite while and I got confused with usages of Interfaces after an argument with a colleague few days before.
Basically, I have been using Interfaces when I apply a designing patterns. especially, when there are multiple classes want to implement common features.
In my application, there is Hibernate layer and few Sevices classes as example Userservice, CompanySevice and etc.The question was whether we keep, separate interfaces also for each Service classes. Such as UserServiceContract, ComapnyContract and etc. My colleague argument was, there is no need to have interfaces.
I came across that in this tutorial also, the author has used interfaces. But there is no common interface that implements several classes, only once. example interface implentation
The benefit of using the interfaces was in this situation, it improves the code structure. Yes, there is IDE features that show what methods available for a class. But, I still want to get your guys idea too about this.
Aucun commentaire:
Enregistrer un commentaire