ITC 466: Advanced .Net Development with C# Homework Assignment # 4 1. Interface Segregation Principle (ISP) · Part 1 · Refactor the code provided (HW4EX1Code) to honor the ISP. · Part 2 · Assume that...

I'm so lost


ITC 466: Advanced .Net Development with C#  Homework Assignment # 4 1. Interface Segregation Principle (ISP) · Part 1 · Refactor the code provided (HW4EX1Code) to honor the ISP. · Part 2 · Assume that the provided code is a class library (dll) and cannot be modified. Create a new class and/or interfaces that inherits from and/or injects the base class from the provided code that will honor ISP. 1. Hint: use the Strategy Pattern shown here. Hint: · Client developers are confused by the methods they don’t need. · Maintenance becomes harder because of side effects: a change in an interface forces us to change classes that don’t implement the interface. 2. Dependency Inversion Principle (DIP) · Part 1 · Refactor code provided (HW4EX2) to honor the DIP. · This is the same code that was shown in the lectures. · Continue to refactor,invert, and remove and/or replace dependencies with abstractions. Your order class should look something very similar to this when you are done. To faciliate future functionality, you might create classes like online order, store sales, etc that inherit from the order class (that is one approach). Ensure that you do not violate any of the SOLID principles. · · Eliminate all “newing up” in upper level classes. You may “new up” classes and assign to interfaces in one separate Factory Class (as shown in a previous lecture). · I created some “starter” unit tests, which are in the OrderCheckoutShould.cs file. 1. Add unit tests to adequately test all classes and methods. · Part 2 · Add a Cash Sales Class that inherits from the Order class. Fully implement Cash Sale functionality without making any changes to previous code. You may only add classes honoring OCP. HW4EX1Code.txt using System; namespace HW4EX1 { class Program { static void Main(string[] args) { BurgerOrderService order = new BurgerOrderService(); order.orderBurger(2); // only want a burger only order order.orderFries(0); // throws an exception } } interface IOrder { void orderBurger(int quantity); void orderFries(int fries); void orderCombo(int quantity, int fries); } public class BurgerOrderService : IOrder { public void orderBurger(int quantity) { Console.WriteLine($"Received order for {quantity} burgers"); } public void orderFries(int fries) { throw new NotImplementedException("No fries in burger only order"); } public void orderCombo(int quantity, int fries) { throw new NotImplementedException("No combo in burger only order"); } } }
Apr 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here