Usually there are two different roles in pair programming. One person is the driver and the other is the navigator. The navigator does not actually write any of the code, but makes the decisions in determining what code needs to be written to achieve the bigger picture. Navigators are also looking out for any potential issues like typos and bugs. The driver actually writes the code given by the navigator, and maneuvers through different files-carrying out the typical tasks necessary to actually get the code down.
Through paired programming, individuals take turns in each role and get to work on important skills necessary in learning a programming language.
Greater efficiency
When two individuals work together discussing code and solutions out loud it can result in higher quality code. Two eyes and two minds are better than one sometimes.
Engaged collaboration
Individuals learn to work together with problem solving and helping to keep one another focused on the task at hand.
Learning from each other
People have different understandings and methods of writing code. Sharing insight with another can help improves learning for both parties.
Social skills
Learning how to work well with another person with a different coding style and way of communicating is a good way to learn the social skills many employers want in an employee. They want to hire on people who work well with others through any differences.
Interview readiness
Some interviews have applicants pair program with an employee to see how well they will work on a team and can share their technical skills.
Work environment readiness
Having skills in paired programming will get you ready for work environments that utilize this practice of programming.
It is a JS filed included on web pages that uses css-style selectors to find elements and JQuery Methods to do something with the element.
There are multiple methods that can be used with a JQuery object that assigns tasks to elements.
body
tag.JQuery makes coding more simple, sometimes even requiring less code.
Single element - $('ul')
Multiple elements - $('li')
get
and set
dataGet - $('').html();
(will get info for first element only)
Set - $('').html('what you update the element with')
When a selection is created, it stores reference to corresponding nodes in DOM tree not copies
(so the location of where information is stored in the browser memory is stored)
Looping(implicit iteration) - using a class
attribute to all elements getting the element. unless the selector returns multiple elements
Chaining - Several methods in the same selector
.ready() = method that checks page is ready to work with code.
OR
use .each()
method pp.324-325
.html()
- the HTML inside of first element and descendants of that element
.text()
- returns content from selection and text from descendants
.html()
and .text()
- used as setters to update content of each element
replaceWith()
and .remove()
- replace and remove matching elements, their content and child elements
.html()
/.text()
/.replaceWith()
- can take strings. Strings can be stored in a variable and can contain markup
.before()
.after()
.prepend()
.append()
.attr()
.removeAttr()
.addClass()
.removeClass()
var yo = $('p').css('color');
to get and store the color in variable
`%(‘p’).css(‘color’, ‘#292929’); to set the color
Event handling function gets an event object that has methods and properties related to the event.
.on()
Loading JQuery from CDN example: page 355
place scripts at end of page before closing </body>
tag. If placed in the <head>
, it can slow down how quickly the page loads.
HTML should be loaded in DOM tree before script can access HTML within page.