YAGNI (You aren't going to need it) rule says we should the minimum number of elements in our code to do the job.
But whenever I create a class it's recommended that we should first create an interface then extend it by having a child class as per principle "Program to interfaces rather than concrete implementations" so that I can accommodate future requirements better and have more loosely coupled code.
But according to YAGNI, from the beginning, we should avoid creating unnecessary interfaces.
So which to follow and when to follow?
Aucun commentaire:
Enregistrer un commentaire