User loginNavigation |
archivesHarnessing Curiosity to Increase Correctness in End-User ProgrammingHarnessing Curiosity to Increase Correctness in End-User Programming. Aaron Wilson, Margaret Burnett, Laura Beckwith, Orion Granatir, Ledah Casburn, Curtis Cook, Mike Durham, and Gregg Rothermel. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '03). (ACM paywalled link).
Via a seminar on Human Factors in Programming Languages, by Eric Walkingshaw. To quote Eric's blurb:
Unstructured casting considered harmful to securityUnstructured casting (e.g. Java, C#, C++, etc.) can be harmful to security. Structured casting consists of the following: 1: Casting self to an interface implemented by this Actor 2: Upcasting a) an Actor of an implementation type to the interface type of the implementation b) an Actor of an interface type to the interface type that was extended 3: Conditional downcasting of an Actor of an interface type to an extension interface type. (An implementation type cannot be downcast because there is nothing to which to downcast.) Claim: All other casting is unstructured and should be prohibited. Edit: The above was clarified as a result of a perceptive FriAM comment by Marc Stiegler
Actor DepositOnlyAccount[initialBalance:Euro] uses SimpleAccount[initialBalance]。
implements Account using
deposit[anAmount] →
⍠Account⨀SimpleAccount.deposit[anAmount]¶
// use deposit message handler from SimpleAccount (see below)
getBalance[ ] → ⦻¶ // always throw exception
withdraw[anAmount:Euro] → ⦻§▮ // always throw exception
As a result of the above definition, DepositOnlyAccount⊒Account and
getBalance[ ] ↦ ⦻, // always throws exception
withdraw[ ] ↦ ⦻, // always throws exception
deposit[Euro] ↦ Void▮
The above makes use of the following:
Interface Account with
getBalance[ ]↦Euro,
deposit[Euro]↦Void,
withdraw[Euro]↦Void▮
Actor SimpleAccount[startingBalance:Euro]
myBalance ≔ startingBalance。
// myBalance is an assignable variable
// initialized with startingBalance
implements Account using
getBalance[ ] → myBalance¶
deposit[anAmount] →
Void // return Void
afterward myBalance ≔ myBalance+anAmount¶
// the next message is processed with
// myBalance reflecting the deposit
withdraw[anAmount:Euro]:Void →
(amount > myBalance) �
True ⦂ Throw Overdrawn[ ] ⍌
False ⦂ Void // return Void
afterward myBalance ≔ myBalance–anAmount ⍰§▮
// the next message is processed with updated myBalance
|
Browse archivesActive forum topics |
Recent comments
1 day 23 hours ago
2 days 20 hours ago
4 days 58 min ago
4 days 1 hour ago
1 week 2 days ago
1 week 2 days ago
1 week 2 days ago
4 weeks 2 days ago
5 weeks 1 day ago
5 weeks 1 day ago