An empirical study of the use of friends in C++ software

M. English, J. Buckley, Tony Cahill, Kristian Lynch
{"title":"An empirical study of the use of friends in C++ software","authors":"M. English, J. Buckley, Tony Cahill, Kristian Lynch","doi":"10.1109/WPC.2005.7","DOIUrl":null,"url":null,"abstract":"A commonly held belief is that the friend construct in C++ is a violation of encapsulation. However, little empirical analysis of its use has taken place to provide evidence to support this claim. This paper presents a study, which assesses the design implications of including friendship in a system. A number of hypotheses are investigated based on previous work in this area by Counsell and Newson (2000). Our initial findings suggest that classes declared as friends are coupling hotspots, that the more friends a class has the more protected and private members it will contain and that friendship is not used to access inherited protected members.","PeriodicalId":421860,"journal":{"name":"13th International Workshop on Program Comprehension (IWPC'05)","volume":"39 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2005-05-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"9","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"13th International Workshop on Program Comprehension (IWPC'05)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/WPC.2005.7","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 9

Abstract

A commonly held belief is that the friend construct in C++ is a violation of encapsulation. However, little empirical analysis of its use has taken place to provide evidence to support this claim. This paper presents a study, which assesses the design implications of including friendship in a system. A number of hypotheses are investigated based on previous work in this area by Counsell and Newson (2000). Our initial findings suggest that classes declared as friends are coupling hotspots, that the more friends a class has the more protected and private members it will contain and that friendship is not used to access inherited protected members.
在c++软件中使用友元的实证研究
人们普遍认为c++中的友元构造违反了封装。然而,很少对其使用进行实证分析,以提供证据来支持这一说法。本文提出了一项研究,该研究评估了在系统中包含友谊的设计含义。根据Counsell和Newson(2000)在这一领域的先前工作,研究了许多假设。我们的初步发现表明,声明为友元的类是耦合热点,一个类拥有的友元越多,它将包含的受保护和私有成员就越多,而且友元不用于访问继承的受保护成员。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信