110 likes | 230 Views
Cohesive Programming for Distributed Systems: Matching the programming model to the c onceptual model. John A. Thywissen • Arthur Peters 26 March 2014. Some distributed problems are cohesive.
E N D
Cohesive Programming for Distributed Systems:Matching the programming modelto the conceptual model John A. Thywissen • Arthur Peters 26 March 2014
Some distributed problems are cohesive defattemptRegistration() = username = askUser(“Pick a username”)ifisLegal(username)andisUnique(username)thencreateNewUser(username)elsedisplayError(username) A cohesive distributedactivity is conceptually an individual operation
Current techniques shatter cohesion Browser Server defattemptRegistration() = username = askUser(“Pick a username”) def callback(success) =ifnot successthendisplayError(username) ifisLegal(username)thencreateIfUnique(username, callback)else callback(false) remotedef createIfUnique(username) remotedef createIfUnique(username) =ifisUnique(username)thencreateNewUser(username) return trueelsereturn false
dOrcprograms are cohesive dOrc defattemptRegistration() = username = askUser(“Pick a username”)ifisLegal(username)andisUnique(username)thencreateNewUser(username)elsedisplayError(username) Browser Server Distributed Orc =dOrc
Execution of dOrc example username = askUser(“Pick a username”) b = isUnique(username) ifb then createNewUser(username) else displayError(username) isUnique displayError askUser createNewUser username username b
Values have location and policy sets 𝓁t(v) = { A, B } 𝓅(v) = { A, B, C } Invariant: ∀v.∀t. 𝓁t(v) ⊆ 𝓅(v) A B v v D C
For a call: M(x1, ..., xn) P = 𝓅(M) ∩ 𝓅(x1) ∩ ... ∩ 𝓅(xn) Move to any location in P and execute. Fail if there is no such location. The call site rule uses policy sets A B v v D C
For a call: M(x1, ..., xn) Avoid communication Lt= 𝓁t(M) ∩ 𝓁t(x1) ∩ ... ∩ 𝓁t(xn) ∀t. 𝓁t(+) = All locations transform.applyTo(image) sizeof(transform) ≪ sizeof(image) Optimization opportunities abound A B v v D C
x = 1 + 2 displayError(x) Optimization opportunities abound username = askUser(“Pick a username”) move to server with username b = isUnique(username) if b then createNewUser(username) move to browser else move to browser displayError(username) x = f(y) M(x)
The right people and right place Personal experience in all three phases
Cohesive Programming for Distributed Systems defattemptRegistration() = username = askUser(“Pick a username”) ifisLegal(username) andisUnique(username) then createNewUser(username) else displayError(username) isUnique askUser displayError createNewUser username username P = 𝓅(M) ∩ 𝓅(x1) ∩ ... ∩ 𝓅(xn) Lt = 𝓁t(M) ∩ 𝓁t(x1) ∩ ... ∩ 𝓁t(xn) x = f(y) M(x)