This project demonstrates object oriented language's SOLID and DRY principles
At NoForRealz pizza chain we have a custom order management program to run day to day sales operation. Our business model is very simple: We sell only one type of pizza with different toppings that all cost the same. This makes price calculation very straightforward limiting the variables to the number of toppings and the amount of tax based on province. Our chain currently operates in Alberta and Ontario. We have the following requirements and ask you to change the code to meet these needs.
All the code related to these requirements is in one class called Pizza. We know that the code can use some improvement. We grew very fast from a start-up company and have built a lot of technical debt in our codebase over the years. You have time to address some of this debt. Feel free to look for “code smells” and refactor the code to improve quality by applying best practices like SOLID and DRY. After the changes we expect the code to behave exactly as before for old functionality and to support the new requirements.
This project demonstrates object oriented language’s SOLID and DRY principles in C# using .NET Core application.
The application makes use of
Here, when our chain starts operating in BC and it requires tax calculation then we can simply create a class for tax calculation in BC that implements ITaxCalculator interface and we can override GetTotalAfterTax() method that will return price of pizza with tax + national tax.
We are adding national gst tax to every province tax calculator files (AlbertaTaxCalculator and OntarioTaxCalculator). so whenever national gst tax changes (jumps to 6%) then we will have to change every province tax calculator file. Instead of that, we can create one generic class “NationalTaxCalculator” which will contain NationalTax value and that class can be used in province tax calculator files. This way we can solve problem by changing only one file.