收录:
摘要:
Stack Overflow (SO) is one of the world’s largest technical Q&A websites, in which many posts contain code snippets. However, these code snippets may not comply with coding style guidelines and result in the problem of low readability and maintainability. To provide a better understanding of this coding style compliance issue for SO users, we plan and conduct an empirical study on SO. Specifically, we collected over 400,000 code snippets from SO in three languages, namely Python, C/C++, and JavaScript. The posts are divided into two types (i.e., question and answer) and analyzed separately. We found that for the question- and answer-type posts, more than 90% and 60% of code snippets contain style violations. The most frequently found violation is syntax errors for Python and indentations for C/C++ and JavaScript. In addition, the results show that with more violations in code snippets, the 'Score' of Python and C/C++ posts, the 'FavoriteCount' of C/C++ questions, and the 'CommentCount' of JavaScript questions tend to be lower. The findings of our research indicate that code snippets on SO do not have good coding style compliance. Users, especially programming beginners are supposed to be wary of the potential problems of reusing code snippets on SO. © 2023 Knowledge Systems Institute Graduate School. All rights reserved.
关键词:
通讯作者信息:
电子邮件地址:
来源 :
ISSN: 2325-9000
年份: 2023
卷: 2023-July
页码: 130-135
语种: 英文
归属院系: