Refactoring : Consolider une expression conditionnelle
Integer getDeliveryCost(){ if(orderAmount > 25) return 0; if(hasDeliveryVoucher) return 0; if(category == "electronic") return 0; ... }
Etant données 3 conditions ayant le même résultat, combinez-les en une seule condition puis extrayez-les dans une méthode.
Integer getDeliveryCost(){ if(isFree()) return 0; ... }
Commentaires
Enregistrer un commentaire