| CompSci 308 Spring 2025 |
Advanced Software Design and Implementation |
In this lab, you will practice designing APIs, the public classes and their public methods. Thinking about public methods as a service has the power to change your purpose: from simply programming to finish functionality to providing a means to help other programmers innovate (even those on your own team!). An API then, is essentially a contract with developers, now clients, who are enticed to use the API because they know they can rely on the stability of that contract (even if the underlying implementation changes). Thus, many see API design as the most critical part of designing a program, because it affects the design of other dependent components.
In your Cell Society teams, complete the following steps:
The result of this lab will be a set of documents that captures the important points of your team's several directed discussions.
Complete this exercise to examine Java's Collections API from a design perspective (instead of as a user) to compare your experiences with its documented goals and motivations.
Before Moving On: Add your names and summary of your discussion to the file doc/COLLECTION_API.md, then add, commit the file, and push it to your project repository.
Discuss your understanding of Design Principles by having each person share their interpretation of these Design Principles related to abstractions:
Provide a brief summary of this discussion in the file REFACTORING_DISCUSSION.md.
Then, choose three abstractions (inheritance hierarchies or interfaces) from your project and discuss:
Finally, brainstorm three new abstractions that would be helpful to create in light of the given change requirements.
You will know your design is on the right track if the resulting code will:
Before Moving On: add your names, shared Design Principle understanding, three current abstractions, and three new abstractions to the doc/REFACTORING_DISCUSSION.md file, then add, commit the file, and push it to your project repository.
Even though APIs are simply the public classes and their public methods, your mindset is vital to clarify your design intentions about how you want them used and extended in response to changes.
When designing a set of services to be used by other developers (current and future team members), consider the following:
Examine the classes related to Simulations in your Model package from the perspective of APIs by categorizing each public method as:
private)protected) because it primarily serves maintaining adding new SimulationsA simplified view of only the public/protected methods for each team is available here.
Now that you have a sense of the kind of service your project actually provides to programmers, think about the kind of service you wish it provided. In other words, spend this time designing the API instead of just having it happen. Write a simplified (i.e., less than "one page" each) description and goals for the Simulation Model API. Note which classes are abstract/interface and which are concrete (and justify why an abstraction is not appropriate).
Then describe how to use your new Simulation Model API to do the following tasks:
Your written explanation should include both English and Java descriptions of the task:
Exceptions you plan to throw because of errors that might occur within your methods.Before Moving On: Add the following to the file doc/SIMULATION_API.md, and add, commit the file, and push it to your project repository:
Pair up with another team, compare your APIs, and attempt to come up with a common API that could work for both of your projects.
This should require each team to justify their Design Contract, explore trade-offs between the two APIs, and then compromise on choosing one API to promote (a complete existing one or, more likely, a compromise between the two versions). Note, it is very reasonable that much discussion will focus primarily on class and method names!
Before Moving On: Add your names and summary of your discussion to the file doc/SHARED_API.md, then add, commit the file, and push it to each team's project repository.
At the end of lab, push your team's Markdown files to the doc folder of your team repository to submit your notes about your teams' discussions.
Make sure the text of your final commit message is of the form "lab_api_design - NetIDs".