2013年12月6日

Replace conditional with Polymorphism

摘要: namespace RefactoringLib.Ploymorphism.Before{ public class Customer { } public class Employee : Customer { } public class NonEmployee : Customer { } public class OrderProcessor { public decimal ProcessOrder(Customer customer, IEnumerable products) { ... 阅读全文

posted @ 2013-12-06 14:49 backslash112 阅读(294) 评论(0) 推荐(0) 编辑

Switch to strategy

摘要: namespace RefactoringLib.SwitchToStrategy.Before{ public class ClientCode { public decimal CalculateShipping() { ShippingInfo shippingInfo = new ShippingInfo(); return shippingInfo.CalculateShippingAmount(State.Alaska); } } public enum State ... 阅读全文

posted @ 2013-12-06 10:56 backslash112 阅读(202) 评论(0) 推荐(0) 编辑

导航