| CompSci 308 Spring 2021 |
Advanced Software Design and Implementation |
This exercise asks you to start the process of designing a program before you have written the code, i.e., before you have thought about exactly how it will be implemented. The key to this process is to think about high level behavior that you would like classes to implement, i.e., that would make it easier to do the project if they already existed, while being as abstract as possible, i.e., to give your team as much room to change your minds about the implementation when you have to actually code each method.
In your Cell Society teams, complete the following activities today:
For shared WYSIWYG Markdown editing, you can use
At the end of lab, push your markdown files to the doc folder of your team's provided, shared, cellsociety_teamNN repository to submit your notes about your teams' discussions.
Make sure the text of your final commit message is of the form "lab_cellsociety_design - NetIDs".
Design this program without worrying about exactly how it will be implemented. In other words, without writing any actual implementation code, explore trade-offs between alternative designs and describe the best one in enough detail that other programmers could implement it for you using any data structures or file format they want. The key is to focus on abstractions, i.e., superclasses, in your project that can have multiple concrete implementations, i.e., subclasses but specifically only on their behavior, i.e., methods, rather than state, i.e., instance variables. If done well, most of your code will be written using the abstractions without needing to know about specific implementations because they are substitutable.
Examine one person's Game project (preferably one that did not use inheritance) and discuss how to create an inheritance hierarchy from the following kinds of classes to close the Game class and clarify how to make the program open to adding new kinds of these objects:
For each set of objects, write the method signatures (i.e., just the header not the implementation) the superclass would need to have to support all possible subclasses in the game and a comment describing what each method's purpose is. This defines the abstraction that represents all of those concrete examples and what other classes the abstraction must absolutely be dependent on.
Review each person's answers to the planning questions and try to come to a team consensus to start further discussions. Also discuss any issues or concerns anyone has about the specifications or goals of the project (see the Basic Implementation for more details if necessary).
Then consider the following questions as you discuss the basic design elements of the Simulation project. Write a high-level description of the different parts of the project and how they can interact without worrying about the implementation details.
A picture may be helpful to show how your parts are related to and dependent on each other.
Now that your team has thought about the problem generally, use CRC cards to refine your design and help you focus on interface instead of implementation issues. A CRC card is an index card (which nicely limits how much each class can do) that answers the following questions about a class to describe its behavior without getting into the details of how it implements that behavior. Index cards are also useful because they are easy to change and move around to see their relationship visually.
Here are some examples of completed CRC cards. In these examples, the actions are given in English, not as a Java method signature (name, parameters, and return type). Your version must be written as a Java signature to provide more details about the flow of the program.
The following scenarios are provided to help test the completeness and flexibility of your design. By writing the steps needed to complete each case below you will be able to see how effectively your design handles these scenarios and others will be able to better understand how deeply you have considered the basic issues. It may help to role play or draw a diagram of how your classes collaborate to complete each case. For this exercise each step, try to include both the class used and the method used to accomplish the step. To make things more interesting, pair up with another team and try to do this part using their design.
probCatch, for a simulation, Fire, based on the value given in an XML fileHere are some examples of completed Use Cases. In these examples, the steps are given in English, not as a Java method calls. Your version should be written as a sequence of Java method calls to provide more details about the flow of the program.