Activity Contexts: Improving Modularity in Blockchain-based Smart Contracts using Context-oriented Programming

Toni Mattis, R. Hirschfeld
{"title":"Activity Contexts: Improving Modularity in Blockchain-based Smart Contracts using Context-oriented Programming","authors":"Toni Mattis, R. Hirschfeld","doi":"10.1145/3242921.3242926","DOIUrl":null,"url":null,"abstract":"Smart contracts formalize and automate interactions among and between individuals and systems in an executable and decentralized way. They are analogous to objects in object-oriented programming, but their behavior and state is replicated across multiple participants in a network and messages sent to the \"object\" are relayed to all network participants, allowing everyone to keep its replica up-to-date. Originally introduced in the mid-1990s, their recent surge in popularity is linked to a rising interest in blockchain-backed, general-purpose smart contract platforms. Manging contract-specific state and behavior associated with the interacting parties and shared objects is a modularity challenge in smart contracts. Each contract has individual requirements for the (non-contract) objects it interacts with. We observed that smart contracts tend to manage object-specific state and behavior itself, often leading to a single monolithic mediator. We aim at improving encapsulation and separation of concerns by allowing programmers to modularly express instance-specific state and behavior within the scope of a so called Activity Context. Activity Contexts are an extension to objects that collect these modular adaptations and jointly overlay them over instances that participate in the activity modeled by the smart contract. We demonstrate the benefits of Activity Contexts by refactoring an exemplary smart contract and discuss their trade-offs compared to traditional object-oriented decomposition and their integration into an existing layer-based context-oriented ecosystem.","PeriodicalId":383557,"journal":{"name":"Proceedings of the 10th ACM International Workshop on Context-Oriented Programming: Advanced Modularity for Run-time Composition","volume":"50 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2018-07-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 10th ACM International Workshop on Context-Oriented Programming: Advanced Modularity for Run-time Composition","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3242921.3242926","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Smart contracts formalize and automate interactions among and between individuals and systems in an executable and decentralized way. They are analogous to objects in object-oriented programming, but their behavior and state is replicated across multiple participants in a network and messages sent to the "object" are relayed to all network participants, allowing everyone to keep its replica up-to-date. Originally introduced in the mid-1990s, their recent surge in popularity is linked to a rising interest in blockchain-backed, general-purpose smart contract platforms. Manging contract-specific state and behavior associated with the interacting parties and shared objects is a modularity challenge in smart contracts. Each contract has individual requirements for the (non-contract) objects it interacts with. We observed that smart contracts tend to manage object-specific state and behavior itself, often leading to a single monolithic mediator. We aim at improving encapsulation and separation of concerns by allowing programmers to modularly express instance-specific state and behavior within the scope of a so called Activity Context. Activity Contexts are an extension to objects that collect these modular adaptations and jointly overlay them over instances that participate in the activity modeled by the smart contract. We demonstrate the benefits of Activity Contexts by refactoring an exemplary smart contract and discuss their trade-offs compared to traditional object-oriented decomposition and their integration into an existing layer-based context-oriented ecosystem.
活动上下文:使用面向上下文的编程改进基于区块链的智能合约的模块化
智能合约以可执行和分散的方式形式化并自动化个人和系统之间的交互。它们类似于面向对象编程中的对象,但是它们的行为和状态在网络中的多个参与者之间被复制,发送到“对象”的消息被转发给所有网络参与者,允许每个人都保持其副本的最新状态。它们最初于20世纪90年代中期推出,最近的流行与人们对区块链支持的通用智能合约平台的兴趣日益浓厚有关。管理与交互方和共享对象相关的特定于合约的状态和行为是智能合约中的模块化挑战。每个契约对与之交互的(非契约)对象都有单独的需求。我们观察到,智能合约倾向于管理对象特定的状态和行为本身,通常会导致单一的整体中介。我们的目标是通过允许程序员在所谓的活动上下文范围内模块化地表达特定于实例的状态和行为,从而改进关注点的封装和分离。活动上下文是对象的扩展,它收集这些模块化调整,并将它们联合覆盖在参与智能合约建模的活动的实例上。我们通过重构一个典型的智能合约来展示活动上下文的好处,并讨论它们与传统的面向对象分解的权衡,以及它们与现有的基于层的面向上下文的生态系统的集成。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信