{"title":"活动上下文:使用面向上下文的编程改进基于区块链的智能合约的模块化","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":"{\"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}","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}
Activity Contexts: Improving Modularity in Blockchain-based Smart Contracts using Context-oriented Programming
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.