CS 2390 - Coad/Nicola Notation
CS 2390 - Coad/Nicola Notation
Coad/Nicola Notation
I've been referring to "Coad/Nicola" notation to mean the notation used by
Coad and Nicola in the textbook. It's a fairly widely used notation that
was popularized by Coad with other co-authors in earlier books. Another
widely used piece of terminology is "object model" to refer to these
diagrams.
Don't wing it. But the precise details of the notation are unimportant.
Here is what is important:
- Class boxes are rectangles or rounded rectangles with two horizontal
lines in them.
- In the space above the top line you put the name of the class (e.g.
Student)
- In the center gap, you put the names of the attributess of the class
(e.g., in the case of Student, these might be "name" and "major", etc.)
- Below the second line, you put the names of the services (e.g.
"poseQuestion")
Generalization/specialization are shown in C/N notation using the branching
lines with a semi-circle at the split, and whole/part is shown with the
triangle on the connector.
Object connectors (relations that hold in states -- e.g. Student takes
Course) join the two object class boxes in question. I usually put a
label on the connector, because it helps the reader. C&N don't bother to
do that.
You CAN put message connectors on the diagrams (C&N show these as heavy
arrows), but I find that they clutter the diagram. Because they're used to
show how the objects communicate with each other in different situations,
it's easier if you do one of the following:
Show the relevant part of the object model for a particular scenario
(e.g. a student enrolling for a course; MLB gaining expansion teams,
etc.), and put only those message connections on the diagram that occur
in the scenario. Of course, there may be many scenarios, so you'll need
as many diagrams. This is OK if you use a drawing tool or presentation
overlays, but it's a real pain if you have to keep redrawing bits of the
object model.
Don't show them at all. Instead show scenarios as tables, as I discussed
in class. This is the only piece of notation not in the book, and I
introduced it to make life easier for you. It too is quite widely used
in the OO community. Message connections here are shown as one object
invoking another's services.
Like this --
Object | Service Use |
| Team: Arizona | create {entry point} |
| Stadium: Phoenix | create {by Team} |
| Stadium: Phoenix | teamPlayingAt(Arizona) |
| Division: NLWest | addTeam(Arizona) {by Team} |
| League: NationalLeague | addTeam(Arizona) {by
Division} |
Return to course homepage