<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjoseph</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjoseph"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Mjoseph"/>
	<updated>2026-06-08T11:41:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69325</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69325"/>
		<updated>2012-10-31T18:51:11Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot; &amp;lt;br/&amp;gt;&lt;br /&gt;
-G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition&amp;lt;ref name=quote/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Pair programming is one of the corollary practices of Extreme Programming. [http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=quote&amp;gt;[http://en.wikipedia.org/wiki/Gerald_Weinberg Gerald Weinberg]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69324</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69324"/>
		<updated>2012-10-31T18:50:15Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot; &amp;lt;br/&amp;gt;&lt;br /&gt;
-G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Pair programming is one of the corollary practices of Extreme Programming. [http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=quote&amp;gt;[http://en.wikipedia.org/wiki/Gerald_Weinberg Gerald Weinberg]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69322</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69322"/>
		<updated>2012-10-31T18:47:47Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot; &amp;lt;br/&amp;gt;&lt;br /&gt;
-G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69321</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69321"/>
		<updated>2012-10-31T18:47:11Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot;&lt;br /&gt;
-G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69320</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69320"/>
		<updated>2012-10-31T18:46:43Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot;&lt;br /&gt;
-G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69319</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69319"/>
		<updated>2012-10-31T18:45:28Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Pair Programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their''&lt;br /&gt;
  ''own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot;&lt;br /&gt;
    -G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69318</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69318"/>
		<updated>2012-10-31T18:44:39Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Pair Programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
  &amp;quot;''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their&lt;br /&gt;
  own devices, will ignore the most glaring errors in their output — errors that anyone else can see in an instant.''&amp;quot;&lt;br /&gt;
    -G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69317</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=69317"/>
		<updated>2012-10-31T18:41:55Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Pair Programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
&amp;quot;'''The human eye has an almost infinite capacity for not seeing what it does not want to see.... Programmers, if left to their own devices, will ignore the most glaring errors in their output—errors that anyone else can see in an instant.''''&amp;quot;&lt;br /&gt;
  - G. M. Weinberg, The Psychology of Computer Programming Silver Anniversary Edition. New York: Dorset House Publishing, 1998.&lt;br /&gt;
&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular [http://en.wikipedia.org/wiki/Agile_software_development Agile Software Development] technique. We would also explain its benefits, advantages and disadvantages. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products.&amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he writes the code for an implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming (XP)], is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused on task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away because of another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together ====&lt;br /&gt;
It is acceptable to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* Both programmers should be knowledgeable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two.&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure of what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync. &lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often — at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, [http://en.wikipedia.org/wiki/Analysis_of_variance analysis of variance (ANOVA)] was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other [http://www.cs.utexas.edu/users/downing/papers/Agile2007.pdf Agile development methodologies]. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
Overall, there is considerable research going on in the field of pair programming and most of which is in academia. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68549</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68549"/>
		<updated>2012-10-27T00:08:36Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler. All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68546</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68546"/>
		<updated>2012-10-27T00:08:11Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler, All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan. Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68544</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68544"/>
		<updated>2012-10-27T00:07:42Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler, All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;[http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan, Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68541</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68541"/>
		<updated>2012-10-27T00:07:00Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; [http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf Laurie A. Williams, Robert R. Kessler, All I Really Need to Know about Pair Programming I Learned In Kindergarten] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;[http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf Andrew Begel, Nachiappan Nagappan, Pair Programming: What’s in it for Me?]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68533</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68533"/>
		<updated>2012-10-27T00:05:33Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; Laurie A. Williams, Robert R. Kessler, All I Really Need to Know about Pair Programming I Learned In Kindergarten, http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name =ref-pp-academia-ucsc&amp;gt;Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms href=&amp;quot;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;quot;&amp;gt; Andrew Begel, Nachiappan Nagappan, Pair Programming: What’s in it for Me?&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68526</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68526"/>
		<updated>2012-10-27T00:04:03Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Partner picking principles ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.25]]&lt;br /&gt;
&lt;br /&gt;
* Partners should have complementary skills. &lt;br /&gt;
&lt;br /&gt;
* Partners should be of similar skill level. &lt;br /&gt;
&lt;br /&gt;
* Both the partners should be flexible and open to new ideas.&lt;br /&gt;
&lt;br /&gt;
* Both partners should have good communication skills.&lt;br /&gt;
&lt;br /&gt;
* Partners should have compatible schedule.  &lt;br /&gt;
&lt;br /&gt;
* knowledgeable &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; Laurie A. Williams, Robert R. Kessler, All I Really Need to Know about Pair Programming I Learned In Kindergarten, http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;Charlie McDowell, Heather Bullock, Julian Fernald, Linda Werner. The Effects of Pair-Programming on Performance in an Introductory Programming Course http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt; Andrew Begel, Nachiappan Nagappan, Pair Programming: What’s in it for Me? http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68441</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68441"/>
		<updated>2012-10-26T23:33:31Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major perceived benefits of pair programming are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenarios&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68439</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68439"/>
		<updated>2012-10-26T23:30:41Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem &amp;lt;ref name = principle-pair /&amp;gt;. &lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
&lt;br /&gt;
[[File:pair-prg-partner.png|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== When to use Pair Programming == &lt;br /&gt;
Pair programming can be beneficial in certain scenarios. Some of them are mentioned here &amp;lt;ref name = benefit-scenarios /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Pair programming is very appropriate when a new team member is introduced into a group as a form of training. &lt;br /&gt;
&lt;br /&gt;
* It may also be useful in complex re-factoring exercises, where one programmer thinks and the other does the coding. &lt;br /&gt;
&lt;br /&gt;
* It may be used when programming efforts require significant object oriented designs, or development work on algorithms or procedures that have performance considerations.&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
* Better communication skills are developed among the individuals. &lt;br /&gt;
&lt;br /&gt;
* Better quality software is developed because of improved knowledge exchange and different perspectives from different people.&lt;br /&gt;
 &lt;br /&gt;
* The cycle time of software development is improved. &lt;br /&gt;
&lt;br /&gt;
* Programmers are more satisfied in case of pair programming. &lt;br /&gt;
&lt;br /&gt;
* Pair rotation makes staff training easier and reduces product risk. It enhances team building. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* The development progress can get hampered due to conflicts between the programmers and debate breakout among the group.&lt;br /&gt;
&lt;br /&gt;
* Everyone has their own ideas and sometimes it becomes difficult to collaborate different ideas. &lt;br /&gt;
&lt;br /&gt;
* It is possible that only one programmer does more than half of the work in the project. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Pair programming is an agile programming practice which is gaining popularity in both academia and industry. Considerable research is also going on in this area. Major benefits of pair programming found are increased quality of code, fewer bugs, better awareness of code among team members etc. It still has problems like lesser productivity, conflicts among partners etc. Many of these problems could be solved by proper selection of team members and applying pair programming to appropriate type of projects. This a useful software engineering practice which teams should consider to increase the quality of their software products. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = principle-pair&amp;gt; http://anh.cs.luc.edu/170/Kindergarten.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = benefit-scenario&amp;gt; http://ctotodevelopers.blogspot.com/2008/04/when-to-use-pair-programming.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68218</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68218"/>
		<updated>2012-10-26T05:48:17Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Research */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot; &amp;lt;ref name = ref-pp-industry-ms/&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68217</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68217"/>
		<updated>2012-10-26T05:47:29Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Industry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68216</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68216"/>
		<updated>2012-10-26T05:47:00Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Industry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot;&amp;lt;ref name = ref-pp-industry-ms&amp;gt;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68215</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68215"/>
		<updated>2012-10-26T05:46:43Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-industry-ms&amp;gt;http://research.microsoft.com/en-us/um/people/abegel/papers/esem-begel-2008.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68214</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68214"/>
		<updated>2012-10-26T05:45:57Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Industry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done by Andrew Begel and Nachiappan Nagappan on Pair Programming at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68213</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68213"/>
		<updated>2012-10-26T05:42:39Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Industry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
Research done Andrew Begel and Nachiappan Nagappan at Microsoft by was published in the paper entitled &amp;quot;Pair Programming: What's in it for Me?&amp;quot;. Their main focus was to understand how pair programming methodologies are used, what kinds of problems and benefits they are perceived to have, the types of partners people would like to work, and a general consensus on PP's usefulness in the software engineering professional community. They did this by asking a sample of developers at Microsoft directly about their current development practices.&lt;br /&gt;
&lt;br /&gt;
Their findings were interesting. They found that 22% of the participants had practiced pair programming, but only 3.5% did it in their current project. Most practitioners are more experienced than the average Microsoft employee practicing other Agile development methodologies. Around two-thirds like pair programming and believe it is a workable practice, but less than half would agree to that of their team's use of pair programming. Three-eighths of the respondents believe that pair programming takes more time than programming alone, but two-thirds believe that the quality of the resulting software is better.&lt;br /&gt;
&lt;br /&gt;
Also part of the survey was trying to rank the perceived benefits and problems of pair programming. The top benefit reported was fewer bugs in the source code and spotting of bugs earlier. The second most cited benefit indicated that pair programming helps to spread code understanding between the members of the pair. So, &amp;quot;There is never only one person in the team who knows all the code.&amp;quot; In third place was higher quality code. Fourth was the ability to learn from a partner. The use of pair programming is a good way to “quickly ramp-up new members.” The fifth benefit was the perception that software being built had a “better architecture and implementation” mainly due to “adherence to good design and standards.”&lt;br /&gt;
&lt;br /&gt;
The participants noted few problems with pair programming too. The number one problem reported with pair programming was cost. Two people are being paid to the do the work of one. The second problem is scheduling time to work in pairs. Two partners require equivalent schedules and suffered double scheduling conflicts. The third most cited problem is a clash of personalities. Finding compatible partners is a difficult process according to many. The fourth problem was trouble resolving disagreements and the fifth problem was that engineers were worried that they will be paired with a partner who is not as smart or skilled as they are.&lt;br /&gt;
&lt;br /&gt;
The study also published a list of qualities that programmers desired in their partners ordered according to preference. The top attribute of a good pair programming partner is that the person has complementary skills to your own. The sentiment in most responses was that my partner “usually looks at things from a different angle.” and he has a “different background which provides a different perspective.” The second attribute is flexibility. An ideal partner is “open minded,” and “open to new ideas.” The third attribute that people looked for was communication skills. Every study of pair programming has shown that it is a communications-intensive process. Tied for fourth is that the person is smart and personable.&lt;br /&gt;
&lt;br /&gt;
This study presented an interesting view of the programmers from the industry.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68206</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68206"/>
		<updated>2012-10-26T05:22:42Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Research */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
===Industry===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68162</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68162"/>
		<updated>2012-10-25T05:55:13Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-pp-academia-ucsc&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68161</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68161"/>
		<updated>2012-10-25T05:54:56Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Academia */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot; &amp;lt;ref name = ref-pp-academia-ucsc/&amp;gt;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68160</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68160"/>
		<updated>2012-10-25T05:53:34Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68159</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68159"/>
		<updated>2012-10-25T05:53:15Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;gt;http://users.soe.ucsc.edu/~charlie/pubs/sigcse2002.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68158</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68158"/>
		<updated>2012-10-25T05:51:28Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Academia */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant. Another major statistic was that the percentage of students who finished the final was dramatically higher in the pairing section (92% vs. 76%). So pairing increased the likelihood that students complete introductory programming class.&lt;br /&gt;
&lt;br /&gt;
So according to the study, it appears plausible that as a result of pair-programming, students that might otherwise have dropped the course, completed the course. Also, it also appears that the programs of even the better students benefited from pair-programming. The data also suggested that students who work in pairs produce better programs. Furthermore, they perform comparably on exams (when not adjusted for varying attrition rates), and possibly significantly better on a final exam, to students required to program individually.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68157</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68157"/>
		<updated>2012-10-25T05:47:10Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Ongoing Research */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68156</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68156"/>
		<updated>2012-10-25T05:46:43Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Academia */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Ongoing Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
For this purpose during the 2000-2001 academic year, data was gathered from students enrolled in two sections of an introductory programming course at the University of California – Santa Cruz. These courses were designed for Computer Science, Management and other Engineering majors. One of the two sections required students to complete programming assignments in pairs (N=172), while the other required students to write programs independently(N=141). The programming assignments, lectures, and quizzes were comparable, and the final exam was identical in both sections. The analysis of the data gathered lead to some interesting finds. These are summarized below.&lt;br /&gt;
&lt;br /&gt;
To compare whether programming scores differed as a function of pair-programming experience, analysis of variance (ANOVA) was conducted. Among all students who completed the course, students in the pairing class scored significantly higher on the programming&lt;br /&gt;
assignments (M=86%) than those in the non-pairing class (M=67%). Overall, the scores from the entire pair-programming section (M=86%) were significantly higher than the even scores of the top half of the non-pairing class (M=77%). So we can reject the theory that the scores for the pair programming group merely reflects the work of the brighter student in the group. The mean exam score in the non-pairing class (M= 75%) was slightly higher than the mean exam score in the pairing class (M=73%). This small difference, however, was not statistically significant.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68155</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w9 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w9_ms&amp;diff=68155"/>
		<updated>2012-10-25T05:36:53Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Ongoing Research */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pair programming 1.jpg|thumb|Pair programming|upright=1.5]]&lt;br /&gt;
&lt;br /&gt;
=Pair Programming=&lt;br /&gt;
This chapter will explain basic concepts of pair programming which is one of the popular Agile Software Development technique. We would also explain its benefits, advantages and disadvantages of pair programming. In the end we will conclude the topic by mentioning ongoing research in this field. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Pair programming is a style of programming in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code or test. Use of this practice has been demonstrated to improve productivity and quality of software products in one of the paper &amp;lt;ref name = ref-paper /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Pair programming practice, two software engineers work on one task at one computer. One of the engineer acts as a driver who has control of the keyboard and mouse and (s)he creates the implementation. The other engineer acts as a navigator (also called as an observer) and watches and reviews the driver's implementation to identify defects and participates in on-demand brainstorming. The roles of driver and navigator are periodically rotated between the two software engineers. The observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the &amp;quot;tactical&amp;quot; aspects of completing the current task, using the observer as a safety net and guide.&lt;br /&gt;
&lt;br /&gt;
Extreme Programming (XP), is an emerging software development methodology. Pair programming is one of the corollary practices of Extreme Programming. XP attributes great success to the use of “pair programming&amp;quot;. XP advocates pair programming with such fervor that even prototyping done solo is scrapped and re-written with a partner. &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Principles of Pair Programming ==&lt;br /&gt;
There are some principles of pair programming in the context of Fulghum's Poem. (Give a link here? )&lt;br /&gt;
==== Share everything ====&lt;br /&gt;
In pair programming, ''two'' programmers are required to produce one piece of software (design, algorithm, code etc.) within a specified time limit. The two programmers are working with one mind responsible for every aspect of this piece of software. Both the driver and a navigator are equal participants in the process and both of the partners own everything and hence they should not blame each other for any defect in the artifact. &lt;br /&gt;
&lt;br /&gt;
==== Play fair ====&lt;br /&gt;
With pair programming, one person has control of the keyboard or is recording design ideas, while the other is continuously reviewing the work. Even when one programmer is significantly more experienced than the other, it is important to take turns “driving,” so that the observer does not become disjoint or feel unimportant.&lt;br /&gt;
&lt;br /&gt;
==== Don't hit your partner ====&lt;br /&gt;
Make sure your partner stays focused and on-task. The driver is awaiting continuous contribution and input from the navigator and hence both the partners should be focused on their part of work. &lt;br /&gt;
&lt;br /&gt;
==== Clean up your mess ====&lt;br /&gt;
Pair programming makes many obvious unnoticed defects go away noticed by another person watching over the shoulders. Additionally, these defects can be removed without the natural animosity that might develop in a formal inspection meeting.&lt;br /&gt;
&lt;br /&gt;
==== Don't take things too seriously ==== &lt;br /&gt;
Pair programming demands ego-less programming approach from both the partners. It is essential for effective programming effort. Excess ego can manifest itself in two ways, both damaging the collaborative relationship. Attitude problems can prevent the programmer from considering others ideas. Secondly, excess ego can cause a programmer to be defensive when receiving criticism or to view this criticism as mistrust. &lt;br /&gt;
&lt;br /&gt;
==== Take a break from working together every afternoon ====&lt;br /&gt;
It is acceptable to to work alone 10-50% of the time. Many programmers prefer to do experimental prototyping and logical thinking alone. &lt;br /&gt;
Simple, well defined coding is more efficiently done by a solitary programmer and then reviewed with a partner. &lt;br /&gt;
&lt;br /&gt;
==== Be aware of the power of two brains ====&lt;br /&gt;
Human beings can remember only to a certain extent and hence one must consult others to increase their knowledge. When two people are working together, each one has their own set of skills and expertise, which should be properly used while producing a piece of software. The unique skills of each individual will allow them to engage in interactions which pool their resources to accomplish their tasks.&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== How to achieve Pair Programming ==&lt;br /&gt;
There are some ways to achieve pair programming for an effective development process &amp;lt;ref name = ways-pair-prg /&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* Prepare together for the coding you are going to do so that no misconceptions will be developed during the coding time. &lt;br /&gt;
&lt;br /&gt;
* Start with a reasonably well-defined task before you sit down. The task should be something you are confident that you can complete in an hour or two&lt;br /&gt;
&lt;br /&gt;
* Agree on a solution: Decide on a general strategy to tackle the task that you decided upon. You may find it helpful to outline what you plan to do before you begin to code.&lt;br /&gt;
&lt;br /&gt;
* Agree on one tiny goal at a time: something you can complete within a few minutes. Stating the problem in words to another person helps focus your mind and helps engage your partner's mind. It also ensures that you both know what you are working on right now.&lt;br /&gt;
&lt;br /&gt;
* Rely on your partner, support your partner. When you're the driver, complete the current tiny goal as quickly as you can, ignoring larger issues. When you're the observer, read the code that the driver is writing as he or she writes it. Your job is code review. You should pay total attention, aiming to let nothing get by you. Think about possible bugs, larger issues, and ways to simplify or improve the design. &lt;br /&gt;
&lt;br /&gt;
* Talk a lot! Say what you are about to do, ask for an implementation idea, ask for a better way to solve the problem at hand, bring up alternative ideas, point out possible inputs that the code doesn't cover, suggest clearer names for variables and subroutines, suggest ways to implement the code in smaller steps, tell the driver that little bit of API knowledge that they need right at the moment they need it, etc. Listen a lot, too, of course. When people are pairing well, they are talking back and forth almost non-stop.&lt;br /&gt;
&lt;br /&gt;
* Sync up frequently. As you are working together, you will find yourself getting out of sync: becoming unsure what your partner is doing, or becoming unclear about the current task. This is normal. When it happens, sync up again. The key to good pairing is to sync up very frequently— within seconds or a minute of noticing that you're out of sync&lt;br /&gt;
&lt;br /&gt;
* Take a moment to celebrate as you complete tasks and overcome problems.&lt;br /&gt;
&lt;br /&gt;
* Switch roles often—at least every half hour. This keeps both the participants fully engaged, and both are in tune with the low-level details and the big picture.  &lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Benefits/Advantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Pair Programming Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== Ongoing Research ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
===Academia===&lt;br /&gt;
A group of researchers from the University of California, Santa Cruz did a study of &amp;quot;The Effects of Pair-Programming on Performance in an Introductory Programming Course&amp;quot;. Computer programming was essentially taught and practiced as a solitary activity. But, they wanted to see if the upcoming trend of Xtreme programming (XP) and especially Pair Programming could help in learning programming.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
[[#top|Back to top]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ref-paper&amp;gt; http://www2.yk.psu.edu/~sg3/cmpbd205/assign/week01/ACMarticlePairProgramming.pdf &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name = ways-pair-prg&amp;gt; http://www.wikihow.com/Pair-Program &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64885</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64885"/>
		<updated>2012-09-15T00:05:05Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Why do we need AOP? The banking example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==AOP in Ruby==&lt;br /&gt;
Ruby does not have native AOP support. But Ruby's metaprogramming features cover many of the aspect requirements. 'method_missing' and reflection in Ruby are classis examples of that. 'method_missing' allows the code to inspect the method call at runtime and redirect to some default method or define a new method if the called method does not exists. Similarly Ruby provides naive support to implement pointcuts and wrapper methods. They are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Pointcut equivalent in Ruby===&lt;br /&gt;
There are no pointcuts in Ruby. But they can be simulated by the inspect method that Ruby provides. &lt;br /&gt;
&lt;br /&gt;
  # List all the classes&lt;br /&gt;
  ObjectSpace.each_object(Class) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  # List all the modules&lt;br /&gt;
  ObjectSpace.each_object(Module) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  # List all the instances of class String&lt;br /&gt;
  ObjectSpace.each_object(String) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Adding advice in Ruby===&lt;br /&gt;
In Ruby, alias can be used to wrap methods with advice.&lt;br /&gt;
&lt;br /&gt;
  foo.rb&lt;br /&gt;
  class Foo&lt;br /&gt;
    def bar&lt;br /&gt;
      &amp;quot;bar&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  foo_advice.rb&lt;br /&gt;
  class Foo&lt;br /&gt;
  alias old_bar bar&lt;br /&gt;
    def bar&lt;br /&gt;
      &amp;quot;{[&amp;lt; &amp;quot;+ old_bar+ &amp;quot; &amp;gt;]}”&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the above code, the alias will be executed eveytime a call to method 'bar' is made. The output of the above code will be as follows:&lt;br /&gt;
&lt;br /&gt;
  puts Foo.new.bar&lt;br /&gt;
  =&amp;gt; &amp;quot;{[&amp;lt; bar &amp;gt;]}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==AspectR==&lt;br /&gt;
We saw how AOP can be implemented in Ruby without any extra support in the above sections. AspectR is free library which provides API's to the same for Ruby. Essentially it allows you to wrap code around existing methods in your classes. This can be a good thing (and even affect how you design your code) since it separates different concerns into different parts of the code. The code for AspectR can be downloaded from [http://prdownloads.sf.net/aspectr/aspectr-0-3-5.tar.gz here]. AspectR was originally called advice.rb and written by Avi Bryant. Later Robert Feldt changed/tweaked/extended it.&lt;br /&gt;
&lt;br /&gt;
===Main features of AspectR===&lt;br /&gt;
*Joinpoints: Ruby does not have the notion of Jointpoints. But it can be considered as method or constructor calls or even exception handlers. &lt;br /&gt;
*Advices: It contains before (pre) advice, after returning and after throwing (post) advice, which indicates what is to be done before/after the jointpoint is called. &lt;br /&gt;
*Aspects: They are the classes that inherit from Aspect. It supports &amp;quot;abstract&amp;quot; Aspects and overriding between advices. &lt;br /&gt;
*Wildcards: RegExp can be used in pointcut designators, ie. to specify classes and methods to wrap advice's to. &lt;br /&gt;
*Pointcut parameters advices can access: object and method receiving call, arguments to call, return values, and exceptions raised.&lt;br /&gt;
&lt;br /&gt;
===AspectR Syntax===&lt;br /&gt;
Advice methods are passed a variable number of parameters:&lt;br /&gt;
*the first is the name of the method currently being wrapped&lt;br /&gt;
*the second is the object receiving the method call&lt;br /&gt;
*the third is the exit/return status:&lt;br /&gt;
**Array with return value(s) if the method exited normally&lt;br /&gt;
**true if the method exited with an exception&lt;br /&gt;
**nil if the method hasn't yet exited (for preAdvice)&lt;br /&gt;
*the rest are the arguments that were passed to the wrapped method.&lt;br /&gt;
&lt;br /&gt;
Here is the sample syntax:&lt;br /&gt;
  require 'aspectr'&lt;br /&gt;
  include AspectR&lt;br /&gt;
  class MyAspect &amp;lt; Aspect&lt;br /&gt;
    def someAdviceMethod(method, object, exitstatus, *args)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
      ... some other advice methods ...&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  ma = MyAspect.new&lt;br /&gt;
  ma.wrap(someClassorObject, :preAdvice, :postAdvice, ... methods to wrap...)&lt;br /&gt;
  or&lt;br /&gt;
  ma.wrap(someClassorObject, :preAdvice, :postAdvice, /patternToWrap/)&lt;br /&gt;
  or&lt;br /&gt;
  AspectR.wrap_classes(ma, :preAdvice, :postAdvice,&lt;br /&gt;
                      [Class1, Class2], ...methods to wrap...)&lt;br /&gt;
===Banking account example in AspectR===&lt;br /&gt;
&lt;br /&gt;
  class BankAccount&lt;br /&gt;
    attr_reader :balance&lt;br /&gt;
    def balance=(amount)&lt;br /&gt;
      @balance = amount&lt;br /&gt;
      persist_balance &lt;br /&gt;
    end&amp;lt;br/&amp;gt;&lt;br /&gt;
    def initialize&lt;br /&gt;
      @balance = retrieve_balance &lt;br /&gt;
    end&amp;lt;br/&amp;gt;&lt;br /&gt;
    def deposit(amount)&lt;br /&gt;
      @balance += amount&lt;br /&gt;
      persist_balance &lt;br /&gt;
    end&amp;lt;br/&amp;gt;&lt;br /&gt;
    def withdraw(amount)&lt;br /&gt;
      if @balance &amp;lt; amount&lt;br /&gt;
        raise InsufficientFundsError&lt;br /&gt;
      end&lt;br /&gt;
      @balance -= amount&lt;br /&gt;
      persist_balance &lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  class Persist &amp;lt; Aspect&lt;br /&gt;
    def retrieve_balance &lt;br /&gt;
      # Get from database&lt;br /&gt;
    end&lt;br /&gt;
    def persist_balance &lt;br /&gt;
      # Save to database&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  Persist.new.wrap(BankingAccount, :retrive_balance, :persist_balance, /withdraw/)&lt;br /&gt;
&lt;br /&gt;
==How AspectR is different from AspectJ==&lt;br /&gt;
*Join points: Join points are not defined separately in AspectR as they are in AspectJ. Instead the method and constructor calls acts as join points. &lt;br /&gt;
*Most of the point cut designator primitives that are present in AspectR differ from AspectR.&lt;br /&gt;
*There is a huge difference in composition of pointcut designators. But you can of course specify several method calls in different classes and objects in a point cut. &lt;br /&gt;
*Around advices are more easy to add in AspectR than AspectJ but mostly before and after advices are used.&lt;br /&gt;
*AspectR has control-flow based crosscutting.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
# [[Aspect-oriented_programming|Aspect Oriented Programming - wikipedia]]&lt;br /&gt;
# An introduction to Aspect-Oriented Programming with AspectJ by Constantinos Constantinides, McGill University&lt;br /&gt;
# [[AspectJ|AspectJ - wikipedia]]&lt;br /&gt;
# [http://aspectr.sourceforge.net/ AspectR - Simple aspect-oriented programming in Ruby]&lt;br /&gt;
# [http://www.ruby-doc.org/gems/docs/a/aspectr-0.3.7/AspectR.html AspectR - Ruby documentation]&lt;br /&gt;
# Aspect-Oriented Programming in Ruby by Dean Wampler&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64802</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64802"/>
		<updated>2012-09-14T23:38:31Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* AOP in Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==AOP in Ruby==&lt;br /&gt;
Ruby does not have native AOP support. But Ruby's metaprogramming features cover many of the aspect requirements. 'method_missing' and reflection in Ruby are classis examples of that. 'method_missing' allows the code to inspect the method call at runtime and redirect to some default method or define a new method if the called method does not exists. Similarly Ruby provides naive support to implement pointcuts and wrapper methods. They are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Pointcut equivalent in Ruby===&lt;br /&gt;
There are no pointcuts in Ruby. But they can be simulated by the inspect method that Ruby provides. &lt;br /&gt;
&lt;br /&gt;
  # List all the classes&lt;br /&gt;
  ObjectSpace.each_object(Class) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  # List all the modules&lt;br /&gt;
  ObjectSpace.each_object(Module) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  # List all the instances of class String&lt;br /&gt;
  ObjectSpace.each_object(String) do |o|&lt;br /&gt;
    puts o.inspect&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Adding advice in Ruby===&lt;br /&gt;
In Ruby, alias can be used to wrap methods with advice.&lt;br /&gt;
&lt;br /&gt;
  foo.rb&lt;br /&gt;
  class Foo&lt;br /&gt;
    def bar&lt;br /&gt;
      &amp;quot;bar&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br/&amp;gt;&lt;br /&gt;
  foo_advice.rb&lt;br /&gt;
  class Foo&lt;br /&gt;
  alias old_bar bar&lt;br /&gt;
    def bar&lt;br /&gt;
      &amp;quot;{[&amp;lt; &amp;quot;+ old_bar+ &amp;quot; &amp;gt;]}”&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the above code, the alias will be executed eveytime a call to method 'bar' is made. The output of the above code will be as follows:&lt;br /&gt;
&lt;br /&gt;
  puts Foo.new.bar&lt;br /&gt;
  =&amp;gt; &amp;quot;{[&amp;lt; bar &amp;gt;]}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==AspectR==&lt;br /&gt;
We saw how AOP can be implemented in Ruby without any extra support in the above sections. AspectR is free library which provides API's to the same for Ruby. Essentially it allows you to wrap code around existing methods in your classes. This can be a good thing (and even affect how you design your code) since it separates different concerns into different parts of the code. The code for AspectR can be downloaded from [http://prdownloads.sf.net/aspectr/aspectr-0-3-5.tar.gz here]. AspectR was originally called advice.rb and written by Avi Bryant. Later Robert Feldt changed/tweaked/extended it.&lt;br /&gt;
&lt;br /&gt;
===Main features of AspectR===&lt;br /&gt;
*Joinpoints: Ruby does not have the notion of Jointpoints. But it can be considered as method or constructor calls or even exception handlers. &lt;br /&gt;
*Advices: It contains before (pre) advice, after returning and after throwing (post) advice, which indicates what is to be done before/after the jointpoint is called. &lt;br /&gt;
*Aspects: They are the classes that inherit from Aspect. It supports &amp;quot;abstract&amp;quot; Aspects and overriding between advices. &lt;br /&gt;
*Wildcards: RegExp can be used in pointcut designators, ie. to specify classes and methods to wrap advice's to. &lt;br /&gt;
*Pointcut parameters advices can access: object and method receiving call, arguments to call, return values, and exceptions raised.&lt;br /&gt;
&lt;br /&gt;
===AspectR Syntax===&lt;br /&gt;
Advice methods are passed a variable number of parameters:&lt;br /&gt;
*the first is the name of the method currently being wrapped&lt;br /&gt;
*the second is the object receiving the method call&lt;br /&gt;
*the third is the exit/return status:&lt;br /&gt;
**Array with return value(s) if the method exited normally&lt;br /&gt;
**true if the method exited with an exception&lt;br /&gt;
**nil if the method hasn't yet exited (for preAdvice)&lt;br /&gt;
*the rest are the arguments that were passed to the wrapped method.&lt;br /&gt;
&lt;br /&gt;
Here is the sample syntax:&lt;br /&gt;
  require 'aspectr'&lt;br /&gt;
  include AspectR&lt;br /&gt;
  class MyAspect &amp;lt; Aspect&lt;br /&gt;
    def someAdviceMethod(method, object, exitstatus, *args)&lt;br /&gt;
      ...&lt;br /&gt;
    end&lt;br /&gt;
      ... some other advice methods ...&lt;br /&gt;
  end&lt;br /&gt;
  ma = MyAspect.new&lt;br /&gt;
  ma.wrap(someClassorObject, :preAdvice, :postAdvice, ... methods to wrap...)&lt;br /&gt;
  or&lt;br /&gt;
  ma.wrap(someClassorObject, :preAdvice, :postAdvice, /patternToWrap/)&lt;br /&gt;
  or&lt;br /&gt;
  AspectR.wrap_classes(ma, :preAdvice, :postAdvice,&lt;br /&gt;
                      [Class1, Class2], ...methods to wrap...)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
# [[Aspect-oriented_programming|Aspect Oriented Programming - wikipedia]]&lt;br /&gt;
# An introduction to Aspect-Oriented Programming with AspectJ by Constantinos Constantinides, McGill University&lt;br /&gt;
# [[AspectJ|AspectJ - wikipedia]]&lt;br /&gt;
# [http://aspectr.sourceforge.net/ AspectR - Simple aspect-oriented programming in Ruby]&lt;br /&gt;
# [http://www.ruby-doc.org/gems/docs/a/aspectr-0.3.7/AspectR.html AspectR - Ruby documentation]&lt;br /&gt;
# Aspect-Oriented Programming in Ruby by Dean Wampler&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64550</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64550"/>
		<updated>2012-09-14T22:09:10Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
# [[Aspect-oriented_programming|Aspect Oriented Programming - wikipedia]]&lt;br /&gt;
# An introduction to Aspect-Oriented Programming with AspectJ by Constantinos Constantinides, McGill University&lt;br /&gt;
# [[AspectJ|AspectJ - wikipedia]]&lt;br /&gt;
# [http://aspectr.sourceforge.net/ AspectR - Simple aspect-oriented programming in Ruby]&lt;br /&gt;
# [http://www.ruby-doc.org/gems/docs/a/aspectr-0.3.7/AspectR.html AspectR - Ruby documentation]&lt;br /&gt;
# Aspect-Oriented Programming in Ruby by Dean Wampler&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64547</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64547"/>
		<updated>2012-09-14T22:08:13Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
# [[Aspect-oriented_programming|Aspect Oriented Programming - wikipedia]]&lt;br /&gt;
# An introduction to Aspect-Oriented Programming with AspectJ by Constantinos Constantinides, McGill University&lt;br /&gt;
# [[AspectJ|AspectJ - wikipedia]]&lt;br /&gt;
# [http://aspectr.sourceforge.net/ AspectR - Simple aspect-oriented programming in Ruby]&lt;br /&gt;
# [http://www.ruby-doc.org/gems/docs/a/aspectr-0.3.7/AspectR.html AspectR - Ruby documentation]&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64508</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64508"/>
		<updated>2012-09-14T21:57:43Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
# [[Aspect-oriented_programming|Aspect Oriented Programming - wikipedia]]&lt;br /&gt;
# An introduction to Aspect-Oriented Programming with AspectJ by Constantinos Constantinides, McGill University&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64483</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64483"/>
		<updated>2012-09-14T21:50:36Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Aspect Oriented Programming (AOP): AspectJ and AspectR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64081</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64081"/>
		<updated>2012-09-13T20:43:27Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Banking example in Java using AOP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
We define the pointcut stateChange as calls to the mutator functions of the BankAccount class, which are the deposit and withdraw functions in the PersistenceAspect. The persistence action should be performed after the above mentioned pointcut. So we define an advice returning, after the pointcut stateChange. So this code will execute everytime after the withdraw and deposit functions and the balance will be persisted.&lt;br /&gt;
&lt;br /&gt;
Thus the BankAccount class contains code only related to the BankAccount. It is completely free of any cross-cutting concerns such as persistence. Other concerns such as user authentication might be implemented similarly.&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64071</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64071"/>
		<updated>2012-09-13T20:38:57Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Banking example in Java using AOP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  class BankAccount {&amp;lt;br/&amp;gt;&lt;br /&gt;
    float balance;&amp;lt;br/&amp;gt;&lt;br /&gt;
    public BankAccount(float balance) {&lt;br /&gt;
      this.balance = balance;&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void deposit(float amount) {&lt;br /&gt;
      balance += amount&lt;br /&gt;
    }&amp;lt;br/&amp;gt;&lt;br /&gt;
    public void withdraw(float amount) {&lt;br /&gt;
      if (balance &amp;lt; amount) {&lt;br /&gt;
        throw new InsufficientFundsException();&lt;br /&gt;
      }&lt;br /&gt;
      balance -= amount;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64068</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64068"/>
		<updated>2012-09-13T20:33:48Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Banking example in Java using AOP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&amp;lt;br/&amp;gt;&lt;br /&gt;
    pointcut stateChange(BankAccount ba):&lt;br /&gt;
      (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
      call(void BankAccount.withdraw(*)))&lt;br /&gt;
      &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64067</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=64067"/>
		<updated>2012-09-13T20:32:31Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* AspectJ: AOP in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===Banking example in Java using AOP===&lt;br /&gt;
Now let us look at how persistence may be added to the BankingAccount example using AspectJ&lt;br /&gt;
&lt;br /&gt;
  aspect PersistenceAspect {&lt;br /&gt;
  pointcut stateChange(BankAccount ba):&lt;br /&gt;
    (call(void BankAccount.deposit(*)) ||&lt;br /&gt;
    call(void BankAccount.withdraw(*)))&lt;br /&gt;
    &amp;amp;&amp;amp; target(ba);&amp;lt;br/&amp;gt;&lt;br /&gt;
    after(BankAccount ba) returning: stateChange(ba) {&lt;br /&gt;
      // persist ba.getBalance() value&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=63923</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=63923"/>
		<updated>2012-09-13T05:04:37Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w5 su]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 wi]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w31 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w16 br]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w23 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w24 nr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w15 rt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w3 pl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w32 cm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w27 ms]]&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63875</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63875"/>
		<updated>2012-09-13T02:47:01Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Pointcuts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
* We can add + to the end of any identifier pattern to indicate that we wish to match a class and all of its subclasses&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
* foo - class foo&lt;br /&gt;
* foo+ - class foo and all of its subclasses&lt;br /&gt;
* foo* - all classes starting with foo&lt;br /&gt;
* foo*+ - all classes starting with foo and all of their subclasses&lt;br /&gt;
* *foo* - all classes with foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63872</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63872"/>
		<updated>2012-09-13T02:43:10Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Pointcuts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Patterns in pointcuts&amp;lt;/b&amp;gt;&lt;br /&gt;
Patterns can also be used to specify events in pointcuts. This would be useful to specify a set of events concisely.&lt;br /&gt;
&lt;br /&gt;
The use of * character is highly overloaded.&lt;br /&gt;
* Using * operator where a type is expected matches any type&lt;br /&gt;
* Using * where an identifier is expected matches any identifier&lt;br /&gt;
* * can also be used in identifier patterns&lt;br /&gt;
** the expression foo* would match any identifier that starts with foo&lt;br /&gt;
** the expression *foo* would match any identifier that has foo in it&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63865</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63865"/>
		<updated>2012-09-13T02:36:59Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Aspect Oriented Programming (AOP) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP): AspectJ and AspectR=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63863</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63863"/>
		<updated>2012-09-13T02:35:49Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* AspectJ: AOP in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP)=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
Various types of joinpoints that are possible in AspectJ are:&lt;br /&gt;
# Calls to methods and constructors&lt;br /&gt;
# Execution of methods and constructors&lt;br /&gt;
# Field access&lt;br /&gt;
# Exception handling&lt;br /&gt;
# Class initializaiton&lt;br /&gt;
# Lexical structure&lt;br /&gt;
# Control flow&lt;br /&gt;
# Self-target and argument type&lt;br /&gt;
# Conditional test&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;br /&gt;
&lt;br /&gt;
====Aspect====&lt;br /&gt;
Much like a class, an Aspect is a unit of modularity. It is defined in terms of pointcuts, advices and ordinary java fields and methods. Pointcuts say which event to match and advice body says what to execute when it matches.&lt;br /&gt;
&lt;br /&gt;
  public aspect Tracer {&lt;br /&gt;
    pointcut mutators(): call(public long BankingAccount.Withdraw(long)) ||&lt;br /&gt;
                           call(public long BankingAccount.Deposit(long));&amp;lt;br/&amp;gt;&lt;br /&gt;
    before() : mutators() {&lt;br /&gt;
      System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
    }    &lt;br /&gt;
  }&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63837</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63837"/>
		<updated>2012-09-13T01:45:35Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* Lanugage description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP)=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. An advice must be define with respect to a pointcut. Given below is an advice defined with respect to the mutators pointcut.&lt;br /&gt;
&lt;br /&gt;
  before() : mutators() {&lt;br /&gt;
    System.out.println(&amp;quot;Mutator called&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
This is a special type of mutator called the before mutator which is called before the joinpoint specified by the pointcut is executed.&lt;br /&gt;
&lt;br /&gt;
There are three ways to associate an advice with a pointcut:&lt;br /&gt;
# Before - run just before the pointcut&lt;br /&gt;
# After - run just after the pointcut&lt;br /&gt;
# Around - Runs instead of the pointcut with the provision for the pointcut to resume execution through a method called proceed().&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). Pointcuts and advices together define composition (weaving) rules.&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63831</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63831"/>
		<updated>2012-09-13T01:33:27Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* AspectJ: AOP in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP)=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;br /&gt;
&lt;br /&gt;
===Lanugage description===&lt;br /&gt;
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:&lt;br /&gt;
&lt;br /&gt;
====Inter-type declarations==== &lt;br /&gt;
These allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor (see visitor pattern) method to the Point class:&lt;br /&gt;
&lt;br /&gt;
  aspect VisitAspect {&lt;br /&gt;
    void Point.acceptVisitor(Visitor v) {&lt;br /&gt;
      v.visit(this);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
====Pointcuts==== &lt;br /&gt;
Pointcuts allow a programmer to specify join points. All pointcuts are expressions (quantifications) that determine whether a given join point matches. A call joinpoint captures an execution event after it evaluates a method calls' arguments, but before it calls the method itself.&lt;br /&gt;
&lt;br /&gt;
For example, this point-cut specifies all calls to GetBalance method in the class BankingAccount that takes no arguments and returns long&lt;br /&gt;
&lt;br /&gt;
  call(public long BankingAccount.GetBalance())&lt;br /&gt;
&lt;br /&gt;
We may also use logical operators in the definition of pointcuts inorder to combine pointcut expressions.&lt;br /&gt;
&lt;br /&gt;
# || (OR operator) - Matches a joinpoint if either left pointcut expression or right pointcut expression matches&lt;br /&gt;
# &amp;amp;&amp;amp; (AND operator) - Matches a joinpoint if both left pointcut expression and right pointcut expression matches&lt;br /&gt;
# ! (NOT operator) - Matches all joinpoints NOT specified by the pointcut expression&lt;br /&gt;
&lt;br /&gt;
Example of a pointcut which matches both mutator methods of the BankingAccount class is&lt;br /&gt;
&lt;br /&gt;
  pointcut mutators(): call(public long BankingAccount.Withdraw(long)) || call(public long BankingAccount.Deposit(long))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Advice==== &lt;br /&gt;
Advice allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. Here, the advice refreshes the display every time something on Point is set, using the pointcut declared above:&lt;br /&gt;
&lt;br /&gt;
  after () : set() {&lt;br /&gt;
    Display.update();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance).&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63826</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63826"/>
		<updated>2012-09-13T01:15:31Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* History and contributors= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP)=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
===History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63825</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w27 ms</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w27_ms&amp;diff=63825"/>
		<updated>2012-09-13T01:15:02Z</updated>

		<summary type="html">&lt;p&gt;Mjoseph: /* AspectJ: AOP in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Aspect Oriented Programming (AOP)=&lt;br /&gt;
&lt;br /&gt;
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Aspect-oriented programming entails breaking down program logic into distinct parts, called concerns. Nearly all programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g., procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they &amp;quot;cut across&amp;quot; multiple abstractions in a program. An example to this is logging. In an normal object oriented language program we might need to invoke a logger function from everywhere we this functionality.&lt;br /&gt;
&lt;br /&gt;
==Why do we need AOP? The banking example==&lt;br /&gt;
Typically, an aspect is scattered or tangled as code, making it harder to understand and maintain. It is scattered by virtue of the function (such as logging) being spread over a number of unrelated functions that might use its function, possibly in entirely unrelated systems, different source languages, etc. That means to change logging can require modifying all affected modules. Aspects become tangled not only with the mainline function of the systems in which they are expressed but also with each other. That means changing one concern entails understanding all the tangled concerns or having some means by which the effect of changes can be inferred.&lt;br /&gt;
&lt;br /&gt;
Consider a simple banking application written in Ruby.&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds'&lt;br /&gt;
 class BankAccount&amp;lt;br/&amp;gt;&lt;br /&gt;
   attr_accessor :balance&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = 0.0&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFunds&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
This is simple enough. But is not very useful. What if we need persistence too?&lt;br /&gt;
&lt;br /&gt;
 require 'insufficient_funds_error'&amp;lt;br/&amp;gt;&lt;br /&gt;
 class BankAccount&lt;br /&gt;
   attr_reader :balance # 1&amp;lt;br/&amp;gt;&lt;br /&gt;
   def balance=(amount)&lt;br /&gt;
     @balance = amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def initialize&lt;br /&gt;
     @balance = retrieve_balance # 3&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def deposit(amount)&lt;br /&gt;
     @balance += amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def withdraw(amount)&lt;br /&gt;
     if @balance &amp;lt; amount&lt;br /&gt;
       raise InsufficientFundsError&lt;br /&gt;
     end&lt;br /&gt;
     @balance -= amount&lt;br /&gt;
     persist_balance # 2&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def retrieve_balance # 3&lt;br /&gt;
     # Get from database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
   def persist_balance # 2&lt;br /&gt;
     # Save to database&lt;br /&gt;
   end&amp;lt;br/&amp;gt;&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
We can see that now other interests have become tangled with the basic functionality (sometimes called the business logic concern). Now add:&lt;br /&gt;
&lt;br /&gt;
* Transactional behavior&lt;br /&gt;
* Authentication and authorization&lt;br /&gt;
* “Observers”, like a UI&lt;br /&gt;
&lt;br /&gt;
Also this code will be repeated across other domain objects which need the same behavior. Finally, attempt to reuse this code in a new application with a different persistence store, transaction engine, security model etc.&lt;br /&gt;
&lt;br /&gt;
===The Problem===&lt;br /&gt;
&lt;br /&gt;
* Persistence itself is already modular&lt;br /&gt;
** But the code that uses it isn’t!&lt;br /&gt;
** Persistence invocation code is scattered&lt;br /&gt;
** BankAccount code is tangled with code from other concerns&lt;br /&gt;
** BankAccount’s modularity is compromised&lt;br /&gt;
* Also, similar persistence code is added to other components&lt;br /&gt;
** Redundancy:&lt;br /&gt;
*** Hard to change all occurrences consistently.&lt;br /&gt;
*** Hard to replace the Persistence solution.&lt;br /&gt;
*** Breaks Don’t Repeat Yourself! (DRY)&lt;br /&gt;
** Reuse is hard.&lt;br /&gt;
*** The persistence solution may be different in another context.&lt;br /&gt;
&lt;br /&gt;
===The Solution: Aspect Oriented Programming===&lt;br /&gt;
AOP attempts to solve this problem by allowing the programmer to express cross-cutting concerns in stand-alone modules called aspects. Then it provides mechanisms for fine-grained modification of target component behavior to incorporate the aspects’ behaviors. Aspects can contain advice (code joined to specified points in the program) and inter-type declarations (structural members added to other classes). For example, a security module can include advice that performs a security check before accessing a bank account.&lt;br /&gt;
&lt;br /&gt;
For example in the above program, the behavior is modified by adding a 'Persistence aspect' to the program. We specify separately where these aspect should be invoked in the banking account application. Now the banking account remains agnostic and the aspect code is maintained in one place. Also, now it is easy to change to a different solution or to remove the concern altogether.&lt;br /&gt;
&lt;br /&gt;
We will see how this is implemented exactly in various implementation of AOP such as AspectJ and AspectR below.&lt;br /&gt;
&lt;br /&gt;
==AOP Concepts==&lt;br /&gt;
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Joinpoint&amp;lt;/b&amp;gt; - a well defined event in the execution of a program (such as the core functionality provided by the persistence class). eg: A call to a method persist_balance from inside the withdraw method.&lt;br /&gt;
* &amp;lt;b&amp;gt;Pointcut&amp;lt;/b&amp;gt; - A collection of join points. eg: A collection of all mutator methods in BankingAccount.&lt;br /&gt;
* &amp;lt;b&amp;gt;Advice&amp;lt;/b&amp;gt; - A block of code that specifies some behavior to be executed before/after/around a certain joinpoint. &lt;br /&gt;
&lt;br /&gt;
Join-point models can be compared based on the join points exposed, how join points are specified, the operations permitted at the join points, and the structural enhancements that can be expressed.&lt;br /&gt;
&lt;br /&gt;
==AspectJ: AOP in Java==&lt;br /&gt;
AspectJ extend the Java programming language with constructs to support AOP. It is a superset of Java such that each valid Java program is also a valid AspectJ program. Also, it is designed as a general purpose language as opposed to a domain specific language. AspectJ is currently the most notable AOP technology.&lt;br /&gt;
&lt;br /&gt;
AspectJ was created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become the widely used de-facto standard for AOP by emphasizing simplicity and usability for end users. It has included IDE integrations for displaying crosscutting structure since its initial public release in 2001.&lt;br /&gt;
&lt;br /&gt;
==History and contributors===&lt;br /&gt;
Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ; he coined the term &amp;quot;crosscutting&amp;quot;. Fourth on the team, Chris Maeda coined the term &amp;quot;aspect-oriented programming.&amp;quot; Jim Hugunin and Erik Hilsdale (Xerox PARC team members 12 and 13) were the original compiler and weaver engineers, Mik Kersten implemented the IDE integration and started the Eclipse AJDT project with Adrian Colyer (current lead of the AspectJ project) and Andrew Clement (current compiler engineer).&lt;br /&gt;
&lt;br /&gt;
The AspectBench Compiler was developed and is being maintained as a joint effort of the Programming Tools Group at the Oxford University Computing Laboratory, the Sable Research Group at McGill University and the Institute for Basic Research in Computer Science (BRICS).&lt;/div&gt;</summary>
		<author><name>Mjoseph</name></author>
	</entry>
</feed>