Desirables
6/25/2016 2parish.saintpats.org kofc809.org
• Have fun!
• Deliver testable functional code to our github project in the time available
o Since the time frame is short it is NOT necessary to complete the entire
goal, however, progress should be testable and functional.
oMake incremental progress via git. Do not wait to the end of time to git
submit.
• Collaborate as a team to get it done
Weatherapp mini sprint
Access this slideshow at:
http://vividventures.biz/d/?q=javascript
6/25/2016 4parish.saintpats.org kofc809.org
Proposed Best Practices
6/25/2016 5parish.saintpats.org kofc809.org
• Software configuration management (SCM)
• Pair programming environments and tools
• Test Driven Development (TDD)
• Continuous Integration (CI)
• Upgrade javascript to latest syntax ES6
Software configuration management - SCM
6/25/2016 6parish.saintpats.org kofc809.org
• In software engineering, software configuration management (SCM or S/W CM) is the task of tracking and controlling changes in the software, part of the larger cross-disciplinary field of configuration management.
6/25/2016 7parish.saintpats.org kofc809.org
An (idealized) successful git branching model
Proposed by
nvie.com
SCM with Github and git
6/25/2016 8parish.saintpats.org kofc809.org
github.comgit-scm.com/downloads
SCM with Github and git
6/25/2016 9parish.saintpats.org kofc809.org
• Sign up for github if not already registered
• See our project at:o https://github.com/Tacoma-JS/weatherapp
o Send a request to me for write access.
• Reference:
o http://git-scm.com/doc
o http://gitref.org/index.html
o Version control with git, second edtion
Github.com – Project review
6/25/2016 10parish.saintpats.org kofc809.org
• Review the
• project graphs -> network
• code -> release(s)
• issues
• open
• closed
Github.com – Project review
6/25/2016 11parish.saintpats.org kofc809.org
• Review the project graphs -> network
• Which branch,• Who’s fork,• is ahead?
Github.com - Project review
6/25/2016 12parish.saintpats.org kofc809.org
• Review the code -> release(s)
Github.com - Project review
6/25/2016 13parish.saintpats.org kofc809.org
• Notice the tag label and release date• Click on the commit link to see the changes
Github.com - Project review
6/25/2016 14parish.saintpats.org kofc809.org
• Issues
To be kind to ourselves the issue numbers are also used as the first characters in the branch name.
Pair Programming
6/25/2016 15parish.saintpats.org kofc809.org
Team (or mob) Programming
6/25/2016 16parish.saintpats.org kofc809.org
< Pair Programming >
6/25/2016 17parish.saintpats.org kofc809.org
• Pair programming is an agile software development technique in which two programmers work together at one workstation.
• One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in.
• The two programmers switch roles frequently
Remote Pair Programming
6/25/2016 18parish.saintpats.org kofc809.org
• Remote pair programming, also known as virtual pair programming or distributed pair programming, is pair programming in which the two programmers are in different locations, working via a collaborative real-time editor, shared desktop, or a remote pair programming IDE plugin.
• Remote pairing introduces difficulties not present in face-to-face pairing, such as extra delays for coordination, depending more on "heavyweight" task-tracking tools instead of "lightweight" ones like index cards, and loss of verbal communication resulting in confusion and conflicts over such things as who "has the keyboard".
Cloud 9 – sign up
6/25/2016 19parish.saintpats.org kofc809.org
• Cloud development environment for pair programming
• Sign up at c9.io if not already registered
Cloud 9 – sign in
6/25/2016 20parish.saintpats.org kofc809.org
• Sign in at c9.io and create a new workspace
Cloud 9 – clone the project
6/25/2016 21parish.saintpats.org kofc809.org
• Get git clone link from our weather app github project
Cloud 9 – create a workspace
6/25/2016 22parish.saintpats.org kofc809.org
• Add workspace name
• Clone link from our weather app githubproject
• Pick node.js template
Other pair programming tools
6/25/2016 24parish.saintpats.org kofc809.org
• Gitter so the whole team can share a messageo with chat history.
• Google hangout ( you will need a Google login to use this tool)• micro.glark.io ( by Bluefinch on github)
Reference:• Github / Tacoma-JS / Best Practices / Pair Programming notes
Where to start working on weather app?
6/25/2016 26parish.saintpats.org kofc809.org
• Whose data are we importing?
• What are the weatherapp issues? [:link:]
• Are there already branches assigned to those issues?
• Will I need the features from the leading edge?
• What branches have been pulled into my working directory?
• Whose fork should I start with?
6/25/2016 27parish.saintpats.org kofc809.org
Openweathermap - sign up / sign in
http://openweathermap.org/
Whose data are we importing?
Generate your API Key and keep it handy.
6/25/2016 28parish.saintpats.org kofc809.org
Cloud 9 - git log in term
git log --oneline --decorate --all --graph
Take note that HEAD is currently on branch master which has a tag. The logcommand should generate a graph that looks somewhat like the projects githubnetwork graph at the time (probably not exactly as shown above) .
6/25/2016 29parish.saintpats.org kofc809.org
Cloud 9 - git checkout in term
git checkout –track origin/’#20_mapping’
git checkout –track origin/’develop’
https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches#Tracking-Branches
6/25/2016 30parish.saintpats.org kofc809.org
Cloud 9 – display index.html page
Click on the .html file
Click on the run button
Note in the terminal the Apache daemon is started
6/25/2016 31parish.saintpats.org kofc809.org
Cloud 9 – display index.html page
Click on ‘Preview Running Application
See app in lower right hand tab
6/25/2016 32parish.saintpats.org kofc809.org
git branches
“ It’s important to note that when you switch branches in Git, files in your working directory will change. If you switch to an older branch, your working directory will be reverted to look like it did the last time you committed on that branch. If Gitcannot do it cleanly, it will not let you switch at all.” 1
Switching branches changes files in your working directory.
1. https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
6/25/2016 33parish.saintpats.org kofc809.org
Cloud 9 – display index.html page
In bash shell change branches with the commandgit checkout master
Click the refresh button, see you app version now on master.
git status lifecycle of a file
6/25/2016 34parish.saintpats.org kofc809.org
Reference: http://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
6/25/2016 35parish.saintpats.org kofc809.org
Project revisions process – clones ahead of origin
origin
Clone 1 r rr rrrAhead by
4
Clone 2 r rrAhead
by3
Clone 3 r Ahead by 1
The r changes in the clones may be ahead of commits to the origin.
6/25/2016 36parish.saintpats.org kofc809.org
Project revisions process
git status
6/25/2016 37parish.saintpats.org kofc809.org
Project revisions process
git add change_log.md
git commit –m ‘Update log with my changes’
git push
6/25/2016 38parish.saintpats.org kofc809.org
Project revisions process
Now the origin master branch has a commit that is different from the develop and the #20_mapping branch.
6/25/2016 39parish.saintpats.org kofc809.org
Project revisions process – clones behind origin
origin r rr rrr
Clone 1 (no diff)
r rr rrr
Clone 2 rrrbehind
by 1
Clone 3 r behind by 2
The r changes in the clones may be behind commits to the origin.
6/25/2016 40parish.saintpats.org kofc809.org
Project revisions process: PULL
git pull
If your clone is behind origin then fetch from and integrate with another repository or a local branch
6/25/2016 41parish.saintpats.org kofc809.org
Revisions process
$gitclone
git branch #nn_branch-name
$ git checkout #nnbranch-name
write test
write code
test code$git add
$git commit
$git pull origin
$git push origin
DONE
6/25/2016 42parish.saintpats.org kofc809.org
git branches
Adding branches$ git branch hotfixes
$ git branch release
$ git branch develop
$ git branch #nn_featured_issue
See a list of branches$ git log --oneline –decorate –graph --all
Change to a different branch$ git checkout #nn_featured_issue
Reference:http://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
Weatherapp requested features
6/25/2016 44parish.saintpats.org kofc809.org
• To request features to the weatherapp we will be using the github issues tab:
o https://github.com/Tacoma-JS/weatherapp/issues
Work on a requested feature
6/25/2016 45parish.saintpats.org kofc809.org
• Issue #21o In wa.convert.xtox() functions include sig-fig in rounding
calculationso https://github.com/Tacoma-JS/weatherapp/issues/21
• Significant figure calculations are nontrivial, it would be DRY
if someone like mevans86 has already provided a sig-figs.js .
• Tacoma-JS fork of sig-figs.js
o https://github.com/Tacoma-JS/significant-figures
Work on a requested feature
6/25/2016 46parish.saintpats.org kofc809.org
• Significant figures references for Issue #21oWikipedia
https://en.wikipedia.org/wiki/Significant_figures
oVideo https://www.khanacademy.org/math/pre-algebra/decimals-pre-
alg/sig-figs-pre-alg/v/significant-figures
o PDF http://www.ruf.rice.edu/~kekule/SignificantFigureRules1.pdf
Work on a requested feature
6/25/2016 47parish.saintpats.org kofc809.org
• Where to start? oWith the unit tests for issue #21 of course!o Test Driven Development
Wikipediahttps://en.wikipedia.org/wiki/Test-driven_development
oA test framework for javascript Jasmine http://jasmine.github.io/ Tutorial http://evanhahn.com/how-do-i-jasmine/ Learn from the spec-sig-figs.js
https://github.com/Tacoma-JS/significant-figures/blob/develop/tests/jasmine/spec/spec_sig_figs.js
Work on a requested feature
6/25/2016 48parish.saintpats.org kofc809.org
It goes without saying (but we will say it) that before gitpushing to origin; your javascript must pass validation tests such as
• Jslint - http://www.jslint.com/
• Jshint - http://jshint.com/
• and html https://validator.nu/.
Continuous Integration w/ Codeship
6/25/2016 49parish.saintpats.org kofc809.org
https://codeship.com/
Continuous Integration w/ Codeship
6/25/2016 50parish.saintpats.org kofc809.org
https://codeship.com/
Continuous Integration w/ Codeship
6/25/2016 51parish.saintpats.org kofc809.org
https://codeship.com/
Write the rules …
Reference
6/25/2016 52parish.saintpats.org kofc809.org
• git• Documentation: http://git-scm.com/doc
• http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
• Book http://it-ebooks.info/book/919/
• http://nvie.com/posts/a-successful-git-branching-model/
• http://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
• TDD pdf IBMdw
• Qunitjs - http://qunitjs.com/
• Test spies, stubs and mocks Sinon.js - http://sinonjs.org/