CompSci 308
Spring 2023
Advanced Software Design and Implementation

SLogo Team Meeting

This exercise asks you to start the process of changing your thinking from simply programming to designing APIs. An Application Programming Interface, API, is simply all the public classes and their public methods. However, thinking about the public methods together as an interface to your program has the power to change how you perceive those methods from just something necessary to make the program functional to providing a service to other programmers (even those on your own team!). An API, then, essentially becomes a contract with developers, now clients, that they can rely on to be stable (even if the underlying implementation changes) and encourages them to extend the service's functionality.

Submitting your Work

At the end of lab, push your team's markdown files to the doc folder of your provided, shared, slogo_teamNN repository to submit your notes about your teams' discussions.

Make sure the text of your final commit message is of the form "lab_slogo_design - NetIDs".

Lab Workflow

In your SLogo teams, complete the following activities today:

  1. Introduce yourselves by sharing:
    • your background and how you are doing in general this semester
    • your motivation/interest in this course
    • your knowledge/interest in other programming languages (especially Logo, Alice, Scratch, Lisp, or something similar) and APIs
    • areas of the project you interested/concerned about
  2. Discuss each person's team experiences and expectations:
    • share good and bad past team experiences and what you learned from them
    • share preferences and styles regarding expectations, communication, and debating/conflict
    • go over the Team Contract (which you will submit individually)
    • choose a time for the next team meeting
  3. Practice thinking about the design if APIs
    • examine Java's Collections API from a design perspective (instead of as a user) to see how it is documented and motivated in the file COLLECTION_API.md
    • review someone's Cell Society project to understand its existing APIs and to help you create more deliberate ones in the file SIMULATION_API.md
  4. Share your ideas for the project and start planning your project
    • clone the shared slogo_teamNN repository to your machine and Open the project within IntelliJ
    • for each API, create a "one page" description of its design goals, contract obligations, and services provided in the file SLOGO_APIs.md
    • use CRC cards to refine your design, focusing more on the interactions between classes than their implementation
    • use Use Cases to verify the completeness and flexibility of your design, by writing "example code", a sequence of method calls from those on your CRC cards

For shared Markdown editing, you can work

Understanding an API

Although the concept is inherently subjective, most developers seem to agree on the main desirable characteristics of an API:

Each person should examine one of the following documents about Java's Collections API and discuss with the rest of the team how well it follows the above characteristics:

Of course, you should bring your own experience using collections by comparing them to the API's design goals. If there is something you like or dislike or something your learned about design during the discussion, make sure to back it up with a specific example.

Some things for you to consider:

API Discovery

In many projects, APIs can serve two different goals based on the clients (other programmers): consumers that use the API and providers that implement/maintain the API:

Examine one person's Cell Society project the perspective of APIs by categorizing each public or protected method in the Simulation part as:

A 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 of both the internal and external Simulation API. Note which classes are abstract/interface and which concrete and, for concrete classes that are part of the external API, justify why they do not need to represent an abstraction.

Then describe how to use your new external and internal APIs to do the following tasks:

Your written explanation should include both English and Java descriptions of the task:

SLogo APIs

Discuss high level design ideas and possible APIs for the SLogo project without worrying about the implementation details (a specific data structure, the parsing algorithm, or the exact layout and OpenJFX components needed). Also discuss any issues or concerns anyone has about the project's specifications or goals.

Consider the following questions:

Write a simplified description for each of the project APIs (i.e., no more than "one page" each) that incorporates your vision for each as well as the public classes and methods. Note which classes you expect to be abstractions (e.g., abstract or interface) and which concrete. For the concrete classes, justify why they do not need to be an abstraction. A class's behavior is its public methods, including any parameters and a return value. These method signatures can be written as they would appear in Java code, but your focus should be on describing their purpose in the class, not their implementation. To summarize a class and its purpose, highlight only the most important methods in this first draft.

Ideally, without any coding or requiring any specific implementation, try to explore trade-offs between several designs and to determine the best one to explore in detail (creating simplified UML style pictures can be helpful here using Markdown).

Class-Responsibility-Collaborator Cards

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 help show the objects more conceptually and the logical relationship between objects more explicitly, making it is easier to understand, evaluate, and modify a design. Answering the following questions about each class helps see them as smart/anthropomorphic collaborators:

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.

Use Cases

The following scenarios are provided to help test the completeness 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.

Here 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 calls to only those Java methods on your CRC cards to provide more details about the flow of the program.

To make things more interesting, pair up with another team and try to do this part using their CRC cards!