SlideShare a Scribd company logo
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
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
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
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
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#
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
Answer Types
 Good

= Recognized
 Accepted = Recognized
 Unaccepted but score >=.4, then recognized
 Low vote (score <=.1)
 Long answer
Question Types
 Classification

criteria – tag/topic & what to

be solved
 Debug /Corrective
 Need-to-know
 How-to-do-it
 Seeking-different-solution
Attributes of a Recognized Answer
 Concise

code
 Using question context
 Highlighting important elements
 Step by step solutions
 Providing links to external resources
 Inline documentation
Attributes of Low Vote Answer
 Lack

of code
 Lack of explanation
 Shortcomings of solution
Answer Recognized but without Code
 Code

may not be necessary
 Link to external resources
 API Queries
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.
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
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
Future Works
 Using

to characteristics of good code
example to we can suggest developer at
coding time with IDE
 Evaluate open-source code quality
Thank you
Questions?

More Related Content

PPTX
Scholarly - Dotforge 2013 Spring
River Tamoor Baig
 
PPTX
A Beginners Guide to Surveys & Research
Abhishek Kumar
 
PDF
NuanceChoosingACodingPartner
Lisa Hazen
 
PPT
香港六合彩
yahooou
 
PPTX
SurfClipse-- An IDE based context-aware Meta Search Engine (Tool Demo)
Masud Rahman
 
PPT
Three things inlife
helbadry
 
PPT
香港六合彩
yahooou
 
PDF
Nokia N86 8MP and N82 low light comparison
Nokia Conversations
 
Scholarly - Dotforge 2013 Spring
River Tamoor Baig
 
A Beginners Guide to Surveys & Research
Abhishek Kumar
 
NuanceChoosingACodingPartner
Lisa Hazen
 
香港六合彩
yahooou
 
SurfClipse-- An IDE based context-aware Meta Search Engine (Tool Demo)
Masud Rahman
 
Three things inlife
helbadry
 
香港六合彩
yahooou
 
Nokia N86 8MP and N82 low light comparison
Nokia Conversations
 

Viewers also liked (14)

KEY
Einführung in WAI-ARIA
Stefan Walter
 
PPT
香港六合彩
yahooou
 
PPTX
SurfExample- Recommendation of Exception Handling Code Examples
Masud Rahman
 
PPT
Ovi Maps - Ultimate routes
Nokia Conversations
 
PPT
Smartphone360 survey
Nokia Conversations
 
PPTX
SurfClipse-- An IDE based context-aware Meta Search Engine (ERA Track)
Masud Rahman
 
PDF
Java RMI Detailed Tutorial
Masud Rahman
 
PDF
Nokia Ovi Le Web08 11dec08
Nokia Conversations
 
PPT
Younghee Jung and Jan Chipchase: Presentation for Nokia Design London Studio ...
Nokia Conversations
 
PPTX
SurfClipse-- An IDE based context-aware Meta Search Engine
Masud Rahman
 
PDF
Nokia: Connecting People In New And Better Ways
Nokia Conversations
 
PPTX
ContentSuggest--Recommendation of Relevant Sections from a Webpage about Erro...
Masud Rahman
 
PPTX
SOAP--Simple Object Access Protocol
Masud Rahman
 
PPT
Nokia Corporate Overview 01jul08
Nokia Conversations
 
Einführung in WAI-ARIA
Stefan Walter
 
香港六合彩
yahooou
 
SurfExample- Recommendation of Exception Handling Code Examples
Masud Rahman
 
Ovi Maps - Ultimate routes
Nokia Conversations
 
Smartphone360 survey
Nokia Conversations
 
SurfClipse-- An IDE based context-aware Meta Search Engine (ERA Track)
Masud Rahman
 
Java RMI Detailed Tutorial
Masud Rahman
 
Nokia Ovi Le Web08 11dec08
Nokia Conversations
 
Younghee Jung and Jan Chipchase: Presentation for Nokia Design London Studio ...
Nokia Conversations
 
SurfClipse-- An IDE based context-aware Meta Search Engine
Masud Rahman
 
Nokia: Connecting People In New And Better Ways
Nokia Conversations
 
ContentSuggest--Recommendation of Relevant Sections from a Webpage about Erro...
Masud Rahman
 
SOAP--Simple Object Access Protocol
Masud Rahman
 
Nokia Corporate Overview 01jul08
Nokia Conversations
 
Ad

Similar to What makes a good code example? (20)

PDF
How to find a Java developer for a successful project
riyak40
 
PDF
How to find a Java developer for a successful project.pdf
mohitd6
 
PDF
How I Cracked the Interview to Become a Full Stack Developer.pdf
Nextskill Technologies
 
PDF
Software engineer's life beyond coding
Nikolay Hubanov
 
PDF
Brochure - Software Development Learning Path
Board Infinity
 
PDF
Behavior Driven Development
NETUserGroupBern
 
PPTX
Automatic Identification of Informative Code in Stack Overflow Posts
Preetha Chatterjee
 
PPSX
Casro Presentation Project And Change Management 1st June 2011
sam_inamdar
 
PDF
Xen Project Contributor Training - Part 1 introduction v1.0
The Linux Foundation
 
PDF
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
University of Hawai‘i at Mānoa
 
PPTX
Soft-Skills-for-Software-Developers-The-Key-to-Career-Success
Ozias Rondon
 
DOCX
Top 10 Interview Questions for Coding Job.docx
Surendra Gusain
 
DOCX
Top 10 Interview Questions for Coding Job.docx
Surendra Gusain
 
PPTX
Zeus learning
RohanMistry15
 
PDF
6 Months Industrial Project Training in PHP Delhi/NCR
shane99
 
PDF
Software development learning path - board infinity
Board Infinity
 
PPT
Anti Patterns Siddhesh Lecture1 Of3
Siddhesh Bhobe
 
PDF
Best Practices for Building Successful LLM Applications
BhavulGauri1
 
PDF
Full Stack Software Development
Learnbay
 
PPTX
ChatGPT: What It Is and How It Can Help You in Your Daily Life
lballiache1949
 
How to find a Java developer for a successful project
riyak40
 
How to find a Java developer for a successful project.pdf
mohitd6
 
How I Cracked the Interview to Become a Full Stack Developer.pdf
Nextskill Technologies
 
Software engineer's life beyond coding
Nikolay Hubanov
 
Brochure - Software Development Learning Path
Board Infinity
 
Behavior Driven Development
NETUserGroupBern
 
Automatic Identification of Informative Code in Stack Overflow Posts
Preetha Chatterjee
 
Casro Presentation Project And Change Management 1st June 2011
sam_inamdar
 
Xen Project Contributor Training - Part 1 introduction v1.0
The Linux Foundation
 
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
University of Hawai‘i at Mānoa
 
Soft-Skills-for-Software-Developers-The-Key-to-Career-Success
Ozias Rondon
 
Top 10 Interview Questions for Coding Job.docx
Surendra Gusain
 
Top 10 Interview Questions for Coding Job.docx
Surendra Gusain
 
Zeus learning
RohanMistry15
 
6 Months Industrial Project Training in PHP Delhi/NCR
shane99
 
Software development learning path - board infinity
Board Infinity
 
Anti Patterns Siddhesh Lecture1 Of3
Siddhesh Bhobe
 
Best Practices for Building Successful LLM Applications
BhavulGauri1
 
Full Stack Software Development
Learnbay
 
ChatGPT: What It Is and How It Can Help You in Your Daily Life
lballiache1949
 
Ad

More from Masud Rahman (20)

PPTX
HereWeCode 2022: Dalhousie University
Masud Rahman
 
PPTX
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
Masud Rahman
 
PPTX
PhD Seminar - Masud Rahman, University of Saskatchewan
Masud Rahman
 
PPTX
PhD proposal of Masud Rahman
Masud Rahman
 
PPTX
PhD Comprehensive exam of Masud Rahman
Masud Rahman
 
PPTX
Doctoral Symposium of Masud Rahman
Masud Rahman
 
PPTX
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Masud Rahman
 
PDF
Poster: Improving Bug Localization with Report Quality Dynamics and Query Ref...
Masud Rahman
 
PDF
Impact of Continuous Integration on Code Reviews
Masud Rahman
 
PPTX
Predicting Usefulness of Code Review Comments using Textual Features and Deve...
Masud Rahman
 
PPTX
STRICT: Information Retrieval Based Search Term Identification for Concept Lo...
Masud Rahman
 
PPTX
An Insight into the Unresolved Questions at Stack Overflow
Masud Rahman
 
PPTX
An Insight into the Pull Requests of GitHub
Masud Rahman
 
PPTX
Recommending Insightful Comments for Source Code using Crowdsourced Knowledge
Masud Rahman
 
PPTX
TextRank Based Search Term Identification for Software Change Tasks
Masud Rahman
 
PPTX
CMPT-842-BRACK
Masud Rahman
 
PPTX
RACK: Code Search in the IDE using Crowdsourced Knowledge
Masud Rahman
 
PPTX
RACK: Automatic API Recommendation using Crowdsourced Knowledge
Masud Rahman
 
PPTX
QUICKAR: Automatic Query Reformulation for Concept Location Using Crowdsource...
Masud Rahman
 
PPTX
CORRECT: Code Reviewer Recommendation at GitHub for Vendasta Technologies
Masud Rahman
 
HereWeCode 2022: Dalhousie University
Masud Rahman
 
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
Masud Rahman
 
PhD Seminar - Masud Rahman, University of Saskatchewan
Masud Rahman
 
PhD proposal of Masud Rahman
Masud Rahman
 
PhD Comprehensive exam of Masud Rahman
Masud Rahman
 
Doctoral Symposium of Masud Rahman
Masud Rahman
 
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Masud Rahman
 
Poster: Improving Bug Localization with Report Quality Dynamics and Query Ref...
Masud Rahman
 
Impact of Continuous Integration on Code Reviews
Masud Rahman
 
Predicting Usefulness of Code Review Comments using Textual Features and Deve...
Masud Rahman
 
STRICT: Information Retrieval Based Search Term Identification for Concept Lo...
Masud Rahman
 
An Insight into the Unresolved Questions at Stack Overflow
Masud Rahman
 
An Insight into the Pull Requests of GitHub
Masud Rahman
 
Recommending Insightful Comments for Source Code using Crowdsourced Knowledge
Masud Rahman
 
TextRank Based Search Term Identification for Software Change Tasks
Masud Rahman
 
CMPT-842-BRACK
Masud Rahman
 
RACK: Code Search in the IDE using Crowdsourced Knowledge
Masud Rahman
 
RACK: Automatic API Recommendation using Crowdsourced Knowledge
Masud Rahman
 
QUICKAR: Automatic Query Reformulation for Concept Location Using Crowdsource...
Masud Rahman
 
CORRECT: Code Reviewer Recommendation at GitHub for Vendasta Technologies
Masud Rahman
 

Recently uploaded (20)

PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 

What makes a good code example?

  • 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
  • 8. Question Types  Classification criteria – tag/topic & what to be solved  Debug /Corrective  Need-to-know  How-to-do-it  Seeking-different-solution
  • 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