Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3. [5 marks] Suppose that you are asked to provide a design solution for pluggable software components, i.e., a design where components are viewed
Question 3. [5 marks] Suppose that you are asked to provide a design solution for pluggable software components, i.e., a design where components are viewed as clients and servers, where a server can be replaced with another one without affecting the client. Specifically, suppose that your software is to support sales and needs to compute taxes on sales. Analysis has produced a class Sale that can specify several items being sold, a control class to compute taxes on such sales, and a class TaxCalculator that provides an operation getTaxes(Sale) and returns a list of tax values, one tax value for each item being sold as part of the Sale instance: indeed, different items may be subject to different taxes Suppose that different customers (of the software you are building) are requesting that the software support pluggable components for tax calculation: specifically, calculating taxes could be provided by TaxMaster (a third party software), TaxWeb (a web service). The interface of the services these third party components provide cannot be changed. Additionally, you do not want to change the control class mentioned above since you would have to change it for every new third party service customers would like your software to use (not practical) What design pattern would you use? Justify your answer. Describe the solution and corresponding class diagram, using the design pattern you selected. Use code excerpts where necessary Question 3. [5 marks] Suppose that you are asked to provide a design solution for pluggable software components, i.e., a design where components are viewed as clients and servers, where a server can be replaced with another one without affecting the client. Specifically, suppose that your software is to support sales and needs to compute taxes on sales. Analysis has produced a class Sale that can specify several items being sold, a control class to compute taxes on such sales, and a class TaxCalculator that provides an operation getTaxes(Sale) and returns a list of tax values, one tax value for each item being sold as part of the Sale instance: indeed, different items may be subject to different taxes Suppose that different customers (of the software you are building) are requesting that the software support pluggable components for tax calculation: specifically, calculating taxes could be provided by TaxMaster (a third party software), TaxWeb (a web service). The interface of the services these third party components provide cannot be changed. Additionally, you do not want to change the control class mentioned above since you would have to change it for every new third party service customers would like your software to use (not practical) What design pattern would you use? Justify your answer. Describe the solution and corresponding class diagram, using the design pattern you selected. Use code excerpts where necessary
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started