PWD 2019 20 Lab 8 Git+transactional+nosql PDF
PWD 2019 20 Lab 8 Git+transactional+nosql PDF
Lab 8
Tuesday, March 17th 2020
S. Sotiriadis and A. Provetti
Version control
What we will learn today?
• Version Control
• Use of BitBucket
• Transactional systems
• Database design activity
After PoP 1
• First-hand experience with GiT and github
• Git is a protocol, with myriad implementations.
• github.com, bitbucket.com
• git is also the basis of contemporary software management:
• Gitlab, Allura
Basic ideas
• Preparation of a long code (or document) invariably goes through
several sessions.
• Changes can be incremental, i.e., more code/text or destructive.
• Sometimes we regret the changes and want to go back to the
previous version(s)
• … and which changes do you regret, exactly?
Home-made version control
• Some keep several copies of essentially the same file, called
versions: report-1.doc, report-2.doc …
• Cooperation is done by explicit agreement and negotiated
syncronization:
• report-AP.doc, report-AP2.doc vs. report-AP-2.doc?
• report-AP.doc, report-AP-PW.doc, report-AP-PW-AP2.doc
• this is the baseline
Motivations for version control in software
• coding is now a collective endeavour
• Coding is inherently error prone
• Local changes could have global effect
• For large organizations, authorship and certification could also be
important.
Version control systems
• General protocols that can be implemented by several parties
• CVS, SVN, are centralized, server-based
• Git is [born] de-centralized and now de-facto standard.
• Centralized Git if offered, among others, by Github and Bitbucket.
• You may try, among others, the Bitbucket Git tutorial
Version control systems
• Git extends the File System with rollback and merge features.
• Delta compression keep versions as a description of the changes (+ or
-) from the previous one
• Rollback from version 6 to v. 5: take v0 and apply 5 changes
• Central repository has an independent change history
Version control systems
6. Commit logs
• git log
Example
7. Make a copy of your master branch and make safe edits on it
• git branch newbranch
8. List of branches
• git branch
d) git add .
e) git commit -m “New features added in newbranch”
f) git checkout master
g) git merge -m “Bug solved - merge” newbranch
h) git push origin master
12. Before start coding pull all branch changes (pull changes from other users)
• git pull origin branchname
Transactional systems
Transactional systems
• DB design must be done with the • SQL allows to express constraints
view of a long-term activity, not in on the values assigned to rows
response to a specific/transient • updates that would violate the
queries integrity constraints are rejected
• Tables shall represent either long- • SQL would rather generate errors
term entities or recorded than let you spoil the data
interactions
• Foreign key columns will allow • a rollback mechanism brings the
joins, i.e, navigation and selections DB back to its
among tables previous, consistent state.
• Practical tip: equip tables with two • often we need to package updates
date/time columns: into atomic transactions
• creation and last_updated
Atomic transactions
rental = 1000
begin transaction
update accounts set bal = bal - rental where uid='u1024’
update accounts set bal = bal + rental where uid='u512’
commit