![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
MP8 DiscussionQ: Sagar Shah - June 26, 2007 - I'm confused on an answer to a question posted earlier on this discussion page. The answer states that withholders in the Paycheck are just withholdings for that paycheck, and withholders for an Employee are a complete history of withholdings taken from the Employee (ValueWithHistory). I'm confused about how to combine the ValueWithHistory concept with the Withholder subclasses we're supposed to write. Right now, I have a taxes instance variable declared in the TaxWithholder class, and this is initialized to be a ValueWithHistory. Is this the correct way of doing this? I don't really see how to combine it any other way, and the RetirementWithholder subclass doesn't have anything similar to this.Actually, the more I think about it, the more I'm confused about that whole answer. I still don't see why withholders needs to be passed to Paycheck when it already gets employee. Update - June 27, 2007: Thanks - I wasn't confusing withholdings and withholders, but your other answers helped. A:Nicholas Chen - June 26, 2007 1) You are not confusing the witholdings variable and withholders variable in the Employee class right? withholdings (as a I mentioned below) is a ValueWithHistory and withholders is actually a dictionary. I'm just checking. 2) Withholders (and its subclasses) can be thought of as separate calculations that need to be performed on the paycheck. Each withholder object will calculate a certain amount to deduct from the paycheck. Right now, you should extract For the TaxWithholder, it would be better to extract the Employee >> taxesOn: money at: date and place it in TaxWithholder. The test case actually tests for this. Now the calculation for withholding taxes is isolated to the TaxWithholder class. I did not use ValueWithHistory in the Withholders (or its subclasses). 3) Why withholders needs to be passed to Paycheck since it gets the employee? I am not too sure about this part either since I did not design this system. It is probably for encapsulation so that withholders is not accessed directly from Employee. That is the reason that I can think of. Q: Elkin Florez - June 25, 2007 - I got a question regarding the change of the signature of the Paycheck constructor in 2.2. from: #date:employee:paid:withheld:insurance:totalPaid:totalWithheld: to #date:employee:paid:withholders: This will affect the print out of the check since there is no way for the paycheck to receive the accumulated amounts paid and withheld. I think we should keep these 2 values, however the test case is forcing to delete these values. Is it ok ? Or should the amount paid and the withholdings be a valueWithHistory values? .. is it relevant for the paycheck to keep this historical data ? A: Nicholas Chen - June 26, 2007 - If you are referring to how this affects the the print out of the checks, then it is a missing requirement (neither the test cases nor the instructions specify what to do about this for the payCheck now). Paycheck>>printOnCheckStream is never actually used (it is being called by other methods but those methods are not tested either). I will say do what is reasonable for you. I will not be testing these methods since their requirements are not specified in the assignment. Q: Johnny Mohseni - June 25, 2007 - For Part 1 how much are we to modify in order for it to be deemed "correct"? Making the EmployeeTestCase pass does not alone satisfy all that can be modified (e.g. #earned to #earnedAt: aDate OR #incrementEarned: anAmount to #incrementEarned: anAmount at: aDate). A: Nicholas Chen - June 25, 2007 - Like the instruction says, you can use valueWithHistory for most of the variables. For my implementation I changed transactions, salary, earned, paid, withholding and vacation. I will be looking for those since the changes are pretty simple. Q: Elkin Florez - June 25 - 2007 - I am wondering what the deliverables for MP8 are. Part 2.2 removes all the changes that we had to do in part 2.1, since 2.2 is a generalization of 2.1. So, should we send the solution for 2.1 AND the solution for 2.2 so you can see what we did in 2.1 ? A: Nicholas Chen - June 25, 2007 - Just the solution for Part 2.2 is sufficient; you do not need to specially isolate Part 2.1. But do remember to include the solution for Part 1 Q: Nevedita Mallick - June 26, 2006 - Part 2: what could be the need to store "withholders" within paycheck, this information is already in Employee object and the computation for withholding is done inside makePaycheck method of Employee. The question says, we need to change PostTo method of Paycheck. We already changed it for part 1. For 2.2, Does that mean we need to change it because of some new instance variables introduced as a result of adding retirement withholdings or is there anything else we need to change, which I am missing? Comment Elaine Savino; June 27, 2006: I did not need to change mine for Part 2.2 beyond what I had already done for the other parts. A: A: Paul Adamczyk - June 26, 2006 - In Paycheck, withholders store the withholdings that occured when this paycheck was posted. In Employee, it's a complete history of all withholdings (ValueWithHistory). You probably don't need to change the postTo: method again. Q: Ryan Senior - June 26, 2006 - How does the Smalltalk interpreter know to run the initialize class method in a class? I have a class method, just like in Employee that initializes all the different TaxRates, but for some reason it's not being ran. Then my program throws an error because it has nil, and it's expecting a TaxRate. A: Paul Adamczyk - June 25, 2006 - This method is called when a class is loaded into the image. You can run it manually by saying "TaxRates initialize" or whatever your method is. Don't worry, when I load your homework, it will be called automatically. Q: Elaine Savino - June 25, 2006 - Part 2.2: The test for Exercise22 tests that InsuranceWithholder only has 1 method. However, doesn't it need to have an initialize method as well, that sets employee and paycheck? This is how we did all other initialization, using a mirrored instance creation method as a class method and an initialization method for the instance vars as an instance method. A: Paul Adamczyk - June 25, 2006 - The solution I've been using does all the initialization in the InsuranceChange class, but I don't see any reason to insist on this approach, so it's OK if you make this test case fail. Q: Elaine Savino - June 25, 2006 - Part 2.2: When do the withholders get added to the dictionary of withholders on Employee? Is it during makePaycheckAt: ? A: Paul Adamczyk - June 25, 2006 - Withholders are added to the dictionary when an Employee object is initialized. They can also be added later, as the testTakeHomeAfterTaxesInsuranceRetirement shows. The values of withholders are updated in makePaycheckAt: . Q: Elaine Savino - June 25, 2006 - Part 2.2: should the tax withholder always use a set tax rate of Single? If not, how would it get this from employee if employee no longer stores tax rate? I believe that the earlier versions of this always just used Single so we would just do the same? A: Paul Adamczyk - June 25, 2006 - Assume it's single. Apparently the payroll assignment was even more involved when it was originally written. Q: Nevedita Mallick - June 24, 2006 - If I modify printOn: of valueWithHistory for proper format of the result of salaryHistoryOn: aStream method, i.e. it prints the '$' sign in front of salary value, printOn will print $ for other print messages also. Should we write a different print method in this case which will print with '$' appended and printOn will remain as it is? A: Paul Adamczyk - June 25, 2006 - Define a new method and invoke it directly only when needed. Elaine Savino, June 24, 2006: For Part 2 the test cases tests Employee withholdingAt: . Does this test the return value of the insurance withholding, the tax withholding, or the total withholding? There are too many similarly referenced variables in this thing. Also, for Employee makePaycheckAt: should the amount paid be calculated as earned - paid - withholding (for taxes) - insurance withholding? If so, should these all be at a point in time (ie value history)? A: Paul Adamczyk - June 24, 2006 - Total withholding. Yes. Yes. I agree that the names are confusing. Feel free to refactor them. Link to this Page
|