Missing:
Developers Attentiveness to Example Usage Ohad Barzilay, Blavatnik School of Computer Science, Tel-Aviv University Amiram Yehudai, Blavatnik School of Computer Science, Tel-Aviv University Orit Hazzan, Department of Education in Technology and Science, Technion
October 2010
HAoSE 2010:
The Second Workshop on Human Aspects of Software Engineering
Agenda 2
Research overview Example Attentiveness Observed Context,
Utilization, Scale
Focus group case study Weaving example attentiveness into the software engineering ecosystem Summary
Introduction 3
We did not embark on this research with example usage in mind Our motivation was the refactoring activity Refactoring
code has been performed informally for years before it was conceptualize and given a name [Opdyke 1993]
Looking for “The Next Refactoring” 4
Research overview 5
Iterative process Grounded theory
Phase I: Pilot
Observations
Phase II: Focusing on Examples
• Observations • Interviews
Phase III: Example Barriers
• • • •
Interviews Surveys Literature Case studies
Examples and related areas 6
We define example usage as using an already existing code fragment (the example) within a new context. For example:
Looking for code in the Internet Examples that are part of the documentation Examining code in the code base of the organization And much more…
There is some overlap with the following areas:
Reuse Copy and paste Patterns
Example Attentiveness Observed 7
Phase I: 2
teams in 2 large world wide software companies 1 month, 14 sessions of 2-3 hours each Observed 10 developers
In this talk we focus on one session (during phase I), and we interpret it from the perspective of example attentiveness
Example Attentiveness I Only on Python 8
Example Attentiveness I Only on Python 9
Could you please send me the files you changed? Do you know how to send multiple files in SCP?
Example Attentiveness I Only on Python 10
Ben used Google to search for the Python method but didn’t use it for the SCP syntax Possible reasons: He
wasn’t attentive for this option He might think that short search-write cycles are unique for Python Might be related to the way he learned Python Maybe other reasons?
Example Attentiveness II Read Only 11
12
Example Attentiveness II Read Only
Ben found an example that matches his purpose, however he avoided copying and pasting it but rather typed the code by himself This resulted in several errors, which were later fixed.
Avoiding copy and paste:
Ben associates example with learning. He is not attentive for using also the example code Typing the code by oneself gives him or her additional opportunity to review the code, memorize it and better understand it Ben might consider copy and paste harmful
13
Example Attentiveness III Think Big
14
Example Attentiveness III Think Big
Ben looked each part of its task independently, and did not look for example of the whole scenario Possible reasons:
Ben started to code only after he has already decomposed the problem in his head
He was locked into a mindset, certain level of abstraction and is not attentive for other courses of action
Ben may associate example usage with certain scale and is not attentive using examples otherwise Ben may not be aware of the existence of such examples Ben is missing advanced retrieval techniques (not aware to their existence)
15
Developers attentiveness to example usage
This session demonstrates 3 dependencies of example attentiveness:
Context
Utilization Scale
Would drawing Ben’s attention for new opportunities of example usage change his behavior in the future?
Addressing Attentiveness Issues 16
Two alternatives: Take
a proactive approach to increase developers awareness and attentiveness
Build
an ecosystem in which theses issues are already weaved-in
Ecosystem
Focus group case study 17
Discussing example usage with developers Part of the mechanism we establish to collect industry feedback 20 developers Agenda: Research
review
Discussion Reflection
questionnaires
A follow up questionnaire (after 3 months)
Focus group case study 18
Research Review
In the reflection questionnaires we asked the participants:
Potential benefits of the systematic use of examples Barriers preventing example usage from being applied more extensively Example related techniques
Whether they use examples in their work Whether they are in favor of using examples Whether they were influenced by the session How they estimate the session will affect their work in the future
A follow up (after 3 months)
Did the talk (or completing the questionnaire) affect your awareness to reuse and example usage? If yes, in what way? Have you incorporated any new techniques or practices in your work with respect to example usage? If yes - which?
Reflection 19
A ‘reflective practitioner’ [Schön, 1983,1987] is someone who, at regular intervals, looks back at the work done, and the work process, and considers how they can be improved
reflective practitiones are not happy to carry on at the current standard, they want to improve
Summary of reflection questionnaires 20
7 of the 15 subjects stated that the session increased their level of awareness to new opportunities for example usage Corresponding
to the 3 types of awareness discussed
earlier
4 of the 8 other subjects mentioned that following the session, they had some new ideas about example usage that they considered using in their work
New Opportunities 21
"[I learned a “Till now I that] usedbreaking examples programming task to steps only “Now „asIanrealize inspiration‟. that and looking for an example for each Following example thesearching talk I would step might be less effective techniques can learned” start using the example than looking for anbe example for code as well.”. the entire task"
Selective example usage 22
In another case study we identified additional types of selective example usage (though some of them are not related to attentiveness) The main variability factors are:
Reusing the example code or not Developer's mental state (development mode) Example size Example source Learning factor
Indeed, the first 3 factors correspond to the 3 attentiveness aspects presented above: example context, scale and utilization.
Conceptualization and abstraction 23
"The talk helped [me] formalize some ideas I already had. I had been a “Now “Example I realize usage that requires I'm not a learner-by-example for years but, as theknow, only name one ofadoing its own” :)". you putting name tothat something makes it much more real and relevant."
4 of the 15 subjects addressed the conceptualization and abstraction of example usage in software development
Conceptualization and abstraction 24
These quotes (and others) suggest addressing example usage as an abstract fundamental software activity and not merely as a programming technique The focus group participants consider examples in a wider context:
Developer productivity Development speed Code quality
The focus group participants consider examples for:
Documentation purposes Client training Example-aware development process
Conceptualization and abstraction 25
Implication on the nature of software development “…at
the end of the day, we are all merely plumbers....“
To exploit to full potential of the example usage concept we propose to weave it into the software engineering ecosystem
We demonstrate this idea using the refactoring concept
Refactoring Revisited 26
much more than a a fundamental activity
Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior [www.refactoring.com/]
Appreciating Refactoring 27
The mere identification of refactoring promoted the following important processes: Provided name and definition for the activity Laid the foundations for others to build a catalogue Enabled the development of software tools Promoted new coding practices Influenced the development process These various aspects serve as an ecosystem that exploits the use of refactoring systematically and methodically to leverage its full potential and eliminate its pitfalls and deficiencies
Ecosystem 28
The Software Development Ecosystem 29
Software Practices Software Process
Software Tools
Activity Catalogue
Training
Future work: Example Embedding 30
Example Embedding is the notion of using an already existing code fragment (the example) within a new context Investigate ways in which examples could be used more systematically more extensively and more effectively to exploit their full potential
Further probe whether productivity benefits from using examples habitually and correctly in example supportive environment
Summary 31
Example Attentiveness Observed Context,
Utilization, Scale
Focus group case study Weaving example attentiveness into the software engineering ecosystem
32
Thank You Discussion