4.18.24 Movement Legacies, Reflection, and Review.pptx
What Makes a Good Programming Code Example According to StackOverflow
1. What Makes a Good Code Example?
A Study of Programming Q&A in StackOverflow
Sayed Mehdi
Nasehi,Jonathan Sillito,
Frank Maurer, Chris Burns
Presented By: Mohammad Masudur Rahman
2. Contents
Why Code Example?
Thesis Statement
Stackoverflow Overview
Scores, Answer Types & Question Types
Attributes of Recognized/Good Answer
Attributes of Low-vote Answer
Important Findings & Suggestions
Limitations & Future Works
3. Why Code Example?
New
technology, language, API & tools
Learning psychology – working sample
teaches much
Developer’s productivity
What is a good code example? –open
question
4. Thesis Statement
A
good code example should include
comprehensive code as well as the text
explaining the code
Programming Q&A site like Stackoverflow
provides more customized and helpful
answer to question rather than existing API
documentation, code repositories or search
engines
5. StackOverflow (http://stackoverflow.com/)
A
Programming Q&A site 1m users, 2.78m
questions, 5.77m answers and 10.5m
comments (up to March, 2012)
Natural language search engine
Question, tags, badges
Answer, Editing, Comments
Up vote, Down vote, Reputation
89 sites: http://stackexchange.com/sites#
6. Scores
A
metric for Good and bad example
Score = (Up vote – Down Vote)
Normalized Score
87% got <3, 13% got 10
High score threshold 4
7. Answer Types
Good
= Recognized
Accepted = Recognized
Unaccepted but score >=.4, then recognized
Low vote (score <=.1)
Long answer
9. Attributes of a Recognized Answer
Concise
code
Using question context
Highlighting important elements
Step by step solutions
Providing links to external resources
Inline documentation
10. Attributes of Low Vote Answer
Lack
of code
Lack of explanation
Shortcomings of solution
11. Answer Recognized but without Code
Code
may not be necessary
Link to external resources
API Queries
12. Important Suggestions
Can
the mining tools provide customized
example from code repos. based on
questioner’s expertise? –No, so make it
intelligent
Plaintext documentation- same for all, not
helpful, so, make it wiki-like to meet user’s
needs.
13. Important Findings
Customized
Answer: suits to questioner
needs better than API Docs, code
repositories or search engines.
Customized Answer: reduces mental effort to
understand things, reduces cognitive
distance with info source
Familiar context in solution
Impact of question types on answer
14. My Observation
Only
considered Java related Q &A
Threshold could be changed over time,
Cohen’s kappa measurement
Only score as a metric which may not be
feasible
Posting time, responder’s identity, question
topic may affect the scores
15. Future Works
Using
to characteristics of good code
example to we can suggest developer at
coding time with IDE
Evaluate open-source code quality