Good for DJ over Java - PowerPoint PPT Presentation

About This Presentation
Title:

Good for DJ over Java

Description:

Good for DJ over Java. Extending traversals for collections (b. ... Embedding does mapping work once but requires mapping construct ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 16
Provided by: karllie
Learn more at: https://www2.ccs.neu.edu
Category:
Tags: good | java | onceover | over

less

Transcript and Presenter's Notes

Title: Good for DJ over Java


1
(No Transcript)
2
Good for DJ over Java
  • Extending traversals for collections (b..)
  • returning a single object instead of a collection
    (Find)
  • modifying the collection (Add, Delete)
  • implementations are different for different
    implementations of collections

3
Embedding versus path control
  • Embedding does mapping work once but requires
    mapping construct
  • Path control may repeat mapping work

4
UML Class Diagram
BookName
bN
Book
Copy
Library
copies
books
0..
0..
avail
book
0..
checkOutItems
users
0..
uId
User
Boolean
UserId
5
UML Class Diagram
BookName
bN
Book
Copy
Library
copies
books
0..
book
0..
avail
copy
checkOutItems
0..
users
CheckOutItem
0..
uId
User
Boolean
UserId
6
Interaction schema
Checkout a book for a user
  • CheckOut
  • Library(
  • Find-gt Book Find(availtrue)-gt cCopy
  • Find-gt uUser)
  • addCopy
  • uUser Add-gt Copy
  • cCopy Set(avail,false)-gt Boolean
  • //participants Library, Book, Copy, User

7
Compiler asks for information or determines it by
rules
  • CheckOut (Library lib,BookName bN, UserId uId)
  • libLibrary(
  • Find(this.bNbN)-gt Book
  • Find(availtrue)-gtcCopy
  • Find(this.uIduId)-gt uUser)
  • addCopy
  • uUser Add(c)-gt Copy
  • cCopy Set(avail,false)-gt Boolean

8
Compiler asks for information or determines it by
rules
  • class Library
  • Copy CheckOut
  • (Library lib,BookName bN, UserId uId)
  • Book b lib.Find(to Book,bN,bN)
  • Copy c b.Find (to Copy,avail,true)
  • User u lib.Find(to User,uId,uId)
  • u.Add(Copy,c)
  • c.Set(avail,false) return c

9
For DJ
  • class Library
  • Copy CheckOut
  • (Library lib,BookName bN, UserId uId)
  • Book b cg.Find(lib,to Book,bN,bN)
  • Copy c cg.Find (b,to Copy,avail,true)
  • User u cg.Find(lib,to User,uId,uId)
  • cg.Add(u,to Copy,c)
  • cg.Set(c,to Boolean,avail,false)
  • return c

10
For DJ/paper
  • Book b cg.Find(lib,to Book,bN,bN)
  • Copy c cg.Find (b,to Copy,avail,true)
  • User u cg.Find(lib,to User,uId,uId)
  • cg.Add(u,to Copy,c)
  • Copy cg.Delete(u,to Copy, avail,true)
  • cg.Set(c,to Boolean,avail,false)
  • Boolean cg.Get(c,to Boolean,avail)
  • int cg.Traverse(company,to Salary,v)

11
For DJ/paper/constraints
  • 0.., 1..
  • Book b cg.Find(lib,to Book,bN,bN)
  • cg.Add(u,to Copy,c)
  • cg.Delete(u,to Copy, avail,true)
  • cg.Traverse(company,to Salary,v)
  • cg.Gather(company,to Salary)
  • 0..1, 1..1
  • cg.Set(c,to Boolean,avail,false)
  • cg.Get(c,to Boolean,avail)

12
For DJ/paper/constraints
  • 0.., 1..
  • Book cg.Find(lib,to Book,bN,bN)
  • Find in library lib a book with data member
  • bN bN.
  • void cg.Add(u,to Copy,c)
  • Add to user u a copy c
  • Copy cg.Delete(u,to Copy, avail,true)
  • Delete from user u a copy with avail true

13
For DJ/paper/constraints
  • 0.., 1..
  • int cg.Traverse(company,to Salary,v)
  • traverse from company to Salary and perform
  • visiting actions of v.
  • Vector cg.Gather(company,to Salary)
  • collect all Salary-objects reachable from
  • company
  • 0..1, 1..1
  • Boolean cg.Set(c,to Boolean,avail,false)
  • Boolean cg.Get(c,to Boolean,avail)

14
Compiler asks for information or determines it by
rules
Definition an interaction schema is a
sequence of navigation statements of the
form o1T1 -Action1-gt o2T2 -Action2-gt o3T3 ...
  • CheckOut (lib,bN,uId)
  • libLibrary(
  • Find(this.bNbN)-gt Book
  • Find(availtrue)-gt cCopy
  • Find(this.uIduId)-gt uUser)
  • addCopy only one choice
  • uUser Add(c)-gt Copy
  • cCopy Set(avail,false)-gt Boolean

15
Advantages
  • High-level description of behavior in terms of an
    ideal UML class diagram
  • Behavior can be adapted to many concrete class
    diagrams
  • Some details of action parameters may be filled
    in under compiler control
Write a Comment
User Comments (0)
About PowerShow.com