Week 11 Class 19 Tue Apr 02 Posted: Apr 02
After Class
Project 2: Class Diagram
I posted the feedback as issues in GitHub with the label v2class
.
Announcements
Project 2
Feedback posted in issues at GitHub. Scores will be posted in Brightspace, but are not posted yet.
I will post any feedback about your diagrams in Brightspace. Wait for the announcement.
I am not requiring you to fix all the issues from Project 2 for Project 3. However, you will want to fix issues regarding missing function declaration/definition comments, header comments, EOF problems, indentation, naming, and spaces at EOL, and make those changes to your current code.
Exercise 56: Names
Score in Brightspace. Feedback in Report.md in the repo.
We will have a future Exercise: Names II where the issues I brought up are fixed. You can get started on that at any time.
CPSC 480 Software Engineering (SE)
I also cover the SE course, which is offered in Fall, 2024. It will not be offered in Spring, 2025.
Exercise 63: Static Dispatch
The instructions for Exercise 63 stated:
Filling them in and not commenting them out is the wrong answer. Review instructions before working on an assignment.
Agenda
Exercise 64: Dynamic Dispatch
The repository Base has a set of various method call situations, and a way at run time (using assert()
) to verify which method is actually called.
assert()
in the code that indicates (via a string) which method is called, e.g., for m2()
is it "Base::m2()"
, "Derived::m2()"
, or "DerivedDerived::m2()"
?assert()
, e.g.,Handle each assertion one at a time in order, compiling and running the program (i.e., make run
) after each assertion is completed. The assertion you edited should pass, and you should be onto the next assertion.
You are required to commit for each block of statements in the main program.
Due by 4:30 pm on Friday, Apr 5.
There is no standard diagram to show a vtable. These are my own created using dot notation with GraphViz. GraphViz is for general graph visualization. You can create UML diagrams in GraphViz, but you have to much more work yourself, unlike yuml. Many of the more complex UML Class Diagrams that are in the notes, especially for design patterns are done using GraphViz as it provides more control over the arrangements of the nodes (classes). The vtable diagrams in the notes were originally done as modified UML Class Diagrams in yuml, e.g., VTable Base Pointer but I converted them to GraphViz, with initial conversion using ChatGPT.
Exercise 65: VTable Diagram
In this exercise, you will complete a VTable diagram with a new class, Rectangle
, which inherits from the class Shape
.
The diagram already has all classes and all method definitions. You just have to complete the vtable so that the method pointers in the vtable point to the correct function.
The easiest way to work with the diagram is with GraphVizOnline. Start with the base diagram, and add the dot notation for the vtable method pointers to the correct methods. You can use the Shape and Circle VTable Diagram for an idea of how to get the edges from the Rectangle vtable to the functions.
To get credit, all edges must be correct.
You can also convert the VTableRectangle.dot file using the command-line tool, dot
The dot
program is available on macOS and WSL/Linux with the package graphviz. I also added it to the GitHub Codespaces image.
Note that dot
is part of a number of graph-drawing algorithms (see man dot
). This one uses fdp
to control the placement of the nodes.
Due by 4:30 pm on Friday, Apr 5.
Unless otherwise noted, exercises are due by 4:30 pm on Wed Apr 03