Due Sunday, 27 March, midnight
Your software architect has decided that it is time to curate your code and test suites.
Task 1 Inspect your code and test suites. Make sure that at the end of the week you have accomplished the following:
- Use natural signatures of major methods, not the one that the external test harness suggests. For example, when the test harness demands a "functional" feeding step from your a dealer, as in,
Configuration -> Configurationyour dealer class should still use an imperative signature because it modifies its own state:
-> VoidThe key is that the test harness creates the dealer from the JSON and then extracts JSON after the dealer has run the feeding step.
For imperative methods, formulate an effect statement; for functional ones, formulate a purpose statement.
Shorten every method so that it is at most 20 lines long. For this goal keep in mind that, for example, a dealer does not feed a species directly. It asks the player-owner to feed the species, which in turn just tells the species to eat a food token.This idea of delegating to owned objects is often called Law of Demeter, and this name was coined by your very own Herr Prof. Dr. Lieberherr.
Look for repeated patterns and abstract them into a method.
Ensure that tests for imperative methods not only check that the desired change takes place but also check that things that should not change remain the same. And if you don’t have unit tests for your major methods, now is the last chance you have to create them. (Of course, you must realize that you have been under time pressure because you did not formulate tests up front.)
Your software passes many more tests from the test fest than last week.
Note We will re-run the test fest tomorrow to address questions that some of you asked.