samedi 27 janvier 2018

Design pattern for slightly different functionality

I have a function that delete an order by its id. I have a business rule that transaction should not be deleted if this order have some related comments (for example...). In another use case I can delete such order (even the order have some related comments) but is applied another condition.

I want to follow DRY principle and do not duplicate my code, because these two use cases differ only very short part of my code. Do exist some suitable design patter for this use case?

Aucun commentaire:

Enregistrer un commentaire