1 / 8

Specification to Implementation

This specification outlines a static model with behavior for a scheduler that manages courses, sessions, and instructors. It includes specifications for duration, start and end dates, confirmed status, client information, and more. It also defines invariants to ensure consistency in the system.

ddewitt
Download Presentation

Specification to Implementation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Specification to Implementation

  2. Static model with behavior Scheduler courses sessions instructors * * instructor 0..1 Course Session Instructor sessions * duration: Duration start: Date end: Date confirmed: Boolean; Boolean overlaps ( Session); client: Client * sessions rating: Grade free(Date,Date) course Static model 1 * * qualifiedFor qualifiedInstructors Invariants: inv Instructor::qualifiedFor->includesAll(sessions.course) sessions->forAll(s1,s2|s1<>s2 ==> not s1.overlaps(s2)) inv Session:: confirmed ==> instructor <> null and end = start+course.duration

  3. Redundancy in specifications • Which parts of the following specification are redundant?

  4. Minimal specification Action Scheduler::change_dates (Session s, Date d) pre: s.start > now and (1) s.course<>nil and (2) s.course.duration : Duration (3) post: s.start = d (4) s.end = d + course.duration (5)

  5. Minimal specification Action Scheduler::change_dates (Session s, Date d) pre: s.start > now and (1) /pre s.course<>nil and (2) s.course.duration: Duration (3) post: s.start = d (4) /post s.end = d + course.duration (5)

  6. Question 2 • Implement the following specification

  7. Static model with behavior Scheduler courses sessions instructors * * instructor 0..1 Course Session Instructor sessions * duration: Duration start: Date end: Date confirmed: Boolean; Boolean overlaps ( Session); client: Client * sessions rating: Grade free(Date,Date) course Static model 1 * * qualifiedFor qualifiedInstructors Invariants: inv Instructor::qualifiedFor->includesAll(sessions.course) sessions->forAll(s1,s2|s1<>s2 ==> not s1.overlaps(s2)) inv Session:: confirmed ==> instructor <> null and end = start+course.duration

  8. Specification Action Scheduler::schedule_course(who: Client, c: Course, d: Date) pre: c.qualifiedInstructors->includes (i|i.free(d,d+c.duration)) post: s:Session.new[confirmed & client= who & course=c & start=d]

More Related