Start from these behavioural models; your work begins at the structure.
Register for offering «include»s Check prerequisites (always part of registering); Refuse registration «extend»s Register for offering (only when a prerequisite is unmet or the offering is full).alt in the sequence diagram.alt handles “prerequisite not met / offering full”. Remember: actors get no activation bar.Underline the nouns and verbs in the problem, then sort the nouns into classes, attributes, and things to discard. The verbs become candidate operations.
| Candidate (noun) | Decision | Reason |
|---|---|---|
| Student | Keep (class) | Has identity, attributes (credit limit) and behaviour (registers, drops). |
| Course | Keep (class) | A catalogue entry (e.g. COMP433) with code, title, credits; distinct from its offerings. |
| Offering / section | Keep (class) | A specific delivery of a course in a semester, with time, room, capacity. The thing a student actually registers for. |
| Instructor | Keep (class) | Teaches offerings and records grades. |
| Registrar | Keep (class) | Manages offerings; a distinct role/actor with behaviour. |
| Registration | Keep (association class) | It only exists for a (student, offering) pair and carries date, status and grade - the classic association class. |
| Semester, time, room, capacity, credit limit, date, status, grade | Reject; these are attributes | Simple values that belong inside a class, not objects with their own identity. |
| COMP433 | Reject | An instance of Course, not a class. |
| University, system | Reject | The context / the system boundary itself, not a domain class. |
| Prerequisite | Debatable | Best modelled as a reflexive association on Course (Course–Course), not a class. Could be a class only if it carried its own data. |
| Grade | Debatable | Here an attribute of Registration; would become a class only if grade history/scale needed its own behaviour. |
Verbs → candidate operations: register (for offering), check prerequisites, refuse registration, create registration, confirm, drop (offering), record (grade), manage offerings, view schedule.
A defensible set of classes. Visibility is shown with + public, - private; types follow Sommerville/Adel style.
| Class | Attributes | Key operations |
|---|---|---|
| Student | id, name, creditLimit : int | register(o), drop(o), viewSchedule() |
| Course | code, title, credits : int | - |
| Offering | offeringId, semester, time, room, capacity : int | isFull() : bool, addRegistration(r) |
| Instructor | id, name | recordGrade(r, g) |
| Registrar | id, name | manageOfferings() |
| Registration (assoc. class) | date : Date, status, grade | setGrade(g), drop() |
Student, Instructor and Registrar share id/name, so an abstract Person superclass generalising the three is a reasonable refinement (the generalisation asked for in Task 3). It is optional; show it only if it earns its place.
The associations, with multiplicity at each end:
0..* to 0..*, with Registration as the association class (date, status, grade live on the link, not on Student or Offering).1 to 1..*: an offering cannot exist without its course.1 to 0..*.1 to 0..*.0..* to 0..*.date, status and grade describe one (student, offering) pairing. They cannot sit on Student (a student has many registrations) or on Offering (an offering has many), so they belong to the link itself. That is the textbook signal for an association class.0..*–0..* Offering: a student registers for many offerings up to the credit limit, and an offering enrols many students up to its capacity (zero at each end, because a new student or a freshly created offering may have none yet). Course 1–1..* Offering: every offering belongs to exactly one course, and a course is given as one or more offerings. Instructor 1–0..* and Registrar 1–0..* Offering read the same way.0..* at both ends): a course may require several others and may itself be required by several. Modelling it as a class would add nothing, because it carries no data of its own.id and name; if that is the whole overlap, keeping them separate is fine. Introduce an abstract Person superclass only when it removes real duplication of attributes or behaviour, not for its own sake.register()/drop() by the student, isFull() and addRegistration() during registration, recordGrade() by the instructor, manageOfferings() by the registrar. An operation that no scenario calls, or a message with no operation to land on, signals a gap between the structure and the behaviour.One scenario of Register for offering. The two decisions from the activity diagram (prerequisites met? space available?) collapse into one alt with a guard. The Student is an actor, so it has no activation bar; the «create» message brings the Registration object to life at the point it is created.
checkPrerequisites and isFull. In the [prerequisites met and space available] branch the UI creates the Registration with a «create» message, registers it with the Offering through addRegistration(r) (whose ok return hands control back to the UI), then replies confirm() to the Student; in the [else] branch it replies refuse(reason). The Student is an actor, so it carries no activation bar.alt. It deliberately leaves dropping, grading and browsing to their own diagrams; trying to show every path in one picture is the most common sequence-diagram mistake.checkPrerequisites and isFull are the two decisions of the given activity diagram, in the same order, and the guard [prerequisites met and space available] is precisely the conjunction of their two "yes" branches. The behavioural models stay in step.isFull() is declared on Offering; the controller only calls operations that exist. A message with no home would mean the class model is missing an operation - the sequence diagram is a live check on the structure.«create» message instantiates r : Registration, the association-class object from the class diagram; its box appears at the point of creation. The UI then calls addRegistration(r) on the Offering, and the ok return from that call is what hands control back to the UI, which can then reply confirm() to the Student. The Registration object receives no further message in this scenario, so it stays idle and carries no activation bar, the same situation as the Loan in the companion's Figure 7c.RegistrationUI and Offering are barred.