SECTION 1: CODE REASONING + VERSION CONTROL

Similar documents
SECTION 1: CODE REASONING + VERSION CONTROL

SECTION 1: CODE REASONING + VERSION CONTROL + ECLIPSE

SECTION 2: HW3 Setup.

SECTION 2: Loop Reasoning & HW3 Setup

SECTION 2: Loop Reasoning & HW3 Setup

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

CSE 331 Software Design & Implementation

CSE 391 Lecture 9. Version control with Git

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

b. Developing multiple versions of a software project in parallel

CSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

Revision Control. How can 4. Slides #4 CMPT 276 Dr. B. Fraser. Local Topology Simplified. Git Basics. Revision Control:

Version Control with Git ME 461 Fall 2018

The Old World. Have you ever had to collaborate on a project by

Version Control Systems (Part 1)

Using Git and GitLab: Your first steps. Maurício

Visualizing Git Workflows. A visual guide to 539 workflows


Git Setup Help using GitKraken (CSE 154)

Version Control System GIT

Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

Version Control Systems: Overview

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

CSE 390 Lecture 9. Version control and Subversion (svn)

AMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:

AMath 483/583 Lecture 2

Software Development I

Version control with Git.

Using git to download and update BOUT++

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

Topics covered. Introduction to Git Git workflows Git key concepts Hands on session Branching models. Git 2

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Reasoning About Imperative Programs. COS 441 Slides 10

Version control CSE 403


git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Lab 08. Command Line and Git

The Rock branching strategy is based on the Git Branching Model documented by Vincent Driessen.

Revision Control. An Introduction Using Git 1/15

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Overview. 1. Install git and create a Github account 2. What is git? 3. How does git work? 4. What is GitHub? 5. Quick example using git and GitHub

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Lecture 6 Remotes. Sign in on the attendance sheet!

Intro to Github. Jessica Young

Object Oriented Programming. Week 1 Part 2 Git and egit

A short tutorial on Git. Servesh Muralidharan 4 March 2014

Distributed Version Control

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Windows. Everywhere else

Git Introduction CS 400. February 11, 2018

Git for Version Control

Github/Git Primer. Tyler Hague

INET

Outline. Logistics. Logistics. Principles of Software (CSCI 2600) Spring Logistics csci2600/

Introduction to Git and Github

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Version Control: Gitting Started

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Revision control. INF5750/ Lecture 2 (Part I)

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Welcome! Virtual tutorial will start at 15:00 GMT. Please leave feedback afterwards at:

Configuration Management

TDDC88 Lab 4 Software Configuration Management

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

Version Control Systems

Warm-Up Problem. 1. What is the definition of a Hoare triple satisfying partial correctness? 2. Recall the rule for assignment: x (assignment)

Intro Git Advices. Using Git. Matthieu Moy. Matthieu Moy Git 2016 < 1 / 11 >

FAQ Q: Where/in which branch do I create new code/modify existing code? A: Q: How do I commit new changes? A:

Lecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han

Revision Control and GIT

Git for Subversion users

CS 390 Software Engineering Lecture 5 More Git

Software Tools Subversion

Version Control. CSC207 Fall 2014

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Software Project (Lecture 4): Git & Github

Version Control System - Git. zswu

Version control CSE 403

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -

Using GitHub to Share with SparkFun a

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

How to git with proper etiquette

CS 320 Introduction to Software Engineering Spring February 06, 2017

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

A Practical Introduction to Version Control Systems

Setting up GitHub Version Control with Qt Creator*

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

Software configuration management

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

S18 Modern Version Control with Git

Intro to Linux & Command Line

How to version control like a pro: a roadmap to your reproducible & collaborative research

Git better. Collaborative project management using Git and GitHub. Matteo Sostero March 13, Sant Anna School of Advanced Studies

TCSS 360: SOFTWARE DEVELOPMENT AND QUALITY ASSURANCE

Transcription:

SECTION 1: CODE + OUTLINE Introductions Code Reasoning Forward Reasoning Backward Reasoning Weaker vs. Stronger statements Version control CSE 331 Spring 2018 slides borrowed and adapted from Alex Mariakis and CSE 390a, CSE 331 lecture slides, and Justin Bare and Deric Pang Section 1 slides. ABOUT CODE Two purposes Prove our code is correct Understand why code is correct Forward reasoning: determine what follows from initial conditions Backward reasoning: determine sufficient conditions to obtain a certain result TERMINOLOGY The program state is the values of all the (relevant) variables An assertion is a logical formula referring to the program state (e.g., contents of variables) at a given point An assertion holds for a program state if the formula is true when those values are substituted for the variables

TERMINOLOGY An assertion before the code is a precondition these represent assumptions about when that code is used An assertion after the code is a postcondition these represent what we want the code to accomplish Given: Precondition Finds: postcondition for given precondition. Aka Finds program state after executing code, when using given assumptions of program state before execution. {x >= 0, y >= 0 y = 16; x = x + y x = sqrt(x) y = y - x {x >= 0, y >= 0 y = 16; {x >= 0, y = 16 x = x + y x = sqrt(x) y = y - x

{x >= 0, y >= 0 y = 16; {x >= 0, y = 16 x = x + y {x >= 16, y = 16 x = sqrt(x) y = y - x {x >= 0, y >= 0 y = 16; {x >= 0, y = 16 x = x + y {x >= 16, y = 16 x = sqrt(x) {x >= 4, y = 16 y = y - x {x >= 0, y >= 0 y = 16; {x >= 0, y = 16 x = x + y {x >= 16, y = 16 x = sqrt(x) {x >= 4, y = 16 y = y - x {x >= 4, y <= 12 {true if (x>0) { else { abs = x abs = -x

{true if (x>0) { else { {x > 0 abs = x {x <= 0 abs = -x {true if (x>0) { else { {x > 0 abs = x {x > 0, abs = x {x <= 0 abs = -x {x <= 0, abs = -x {true if (x>0) { else { {x > 0 abs = x {x > 0, abs = x {x <= 0 abs = -x {x <= 0, abs = -x {x > 0, abs = x OR x <= 0, abs = -x {true if (x>0) { else { {x > 0 abs = x {x > 0, abs = x {x <= 0 abs = -x {x <= 0, abs = -x {x > 0, abs = x OR x <= 0, abs = -x {abs = x

Given: Postcondition Finds: The weakest precondition for given postcondition. ASIDE: WEAKEST PRECONDTION? What is weakest precondition? Well, precondition is just a statement, so Better ask what makes a statement weaker vs. Stronger? WEAKER VS. STRONGER Weaker statements = more general Stronger statements = more specific aka more informational Stronger statements are more restrictive Ex: x = 16 is stronger than x > 0 Ex: Alex is an awesome TA is stronger than Alex is a TA If A implies B, A is stronger and B is weaker. If B implies A, B is stronger and A is weaker. If neither, then A and B not comparable. Given: Postcondition Finds: The weakest precondition for given postcondition. So, finds most general assumption code will use to get given postcondition.

a = x + b; c = 2b - 4 x = a + c {x > 0 a = x + b; c = 2b - 4 {a + c > 0 x = a + c {x > 0 a = x + b; {a + 2b 4 > 0 c = 2b - 4 {a + c > 0 x = a + c {x > 0 Backward reasoning is used to determine the weakest precondition {x + 3b - 4 > 0 a = x + b; {a + 2b 4 > 0 c = 2b - 4 {a + c > 0 x = a + c {x > 0

S Hoare triples are just an extension of logical implication Hoare triple: {P S {Q P = precondition S = single line of code Q = postcondition A Hoare triple can be valid or invalid Valid if for all states for which P holds, executing S always produces a state for which Q holds Invalid otherwise EXAMPLE #1 {x!= 0 y = x*x; {y > 0 Is this valid? EXAMPLE #1 {x!= 0 y = x*x; {y > 0 Is this valid? Yes EXAMPLE #2 Is {false S {Q a valid Hoare triple?

EXAMPLE #2 Is {false S {Q a valid Hoare triple? Yes. Because P is false, there are no conditions when P holds Therefore, for all states where P holds (i.e. none) executing S will produce a state in which Q holds EXAMPLE #3 Is {P S {true a valid Hoare triple? EXAMPLE #3 Is {P S {true a valid Hoare triple? Yes. Any state for which P holds that is followed by the execution of S will produce some state For any state, true always holds (i.e. true is true)

WHAT IS VERSION CONTROL? Also known as source control/revision control System for tracking changes to code Software for developing software Essential for managing projects See a history of changes Revert back to an older version Merge changes from multiple sources We ll be talking about git/gitlab, but there are alternatives Subversion, Mercurial, CVS Email, Dropbox, USB sticks (don t even think of doing this) ORGANIZATION A repository stores the master copy of the project Someone creates the repo for a new project Then nobody touches this copy directly Lives on a server everyone can access Each person clones her own working copy Makes a local copy of the repo You ll always work off of this copy The version control system syncs the repo and working copy (with your help) Working copy Repository git Working copy REPOSITORY Can create the repository anywhere Can be on the same computer that you re going to work on, which might be ok for a personal project where you just want rollback protection But, usually you want the repository to be robust: On a computer that s up and running 24/7 Everyone always has access to the project On a computer that has a redundant file system No more worries about that hard disk crash wiping away your project! We ll use CSE GitLab very similar to GitHub but tied to CSE accounts and authentication COMMON ACTIONS Most common commands: commit / push pull integrate changes from your working copy into the repository integrate changes into your working copy from the repository pull Repository git push Working copy

UPDATING FILES COMMON ACTIONS (CONT.) In a bit more detail: You make some local changes, test them, etc., then git add tell git which changed files you want to save in repo git commit save all files you ve add ed in the local repo copy as an identifiable update git push synchronize with the GitLab repo by pushing local committed changes pull Repository git push Working copy Other common commands: add, rm add or delete a file in the working copy just putting a new file in your working copy does not add it to the repo! still need to commit to make permanent pull Repository git push Working copy THIS QUARTER We distribute starter code by adding it to your GitLab repo. You retrieve it with git clone the first time then git pull for later assignments 331 create/push You will write code using Eclipse You turn in your files by adding them to the repo, committing your changes, and eventually pushing accumulated changes to GitLab You turn in an assignment by tagging your repo and pushing the tag to GitLab You will validate your homework by SSHing onto attu, cloning your repo, and running an Ant build file Working copy for grading pull clone/pull Repository Working copy commit/push add

AVOIDING GIT PROBLEMS For the projects in this class, you should never have to merge Except when the staff pushes out a new assignment Rules of thumb for working in multiple places: Each time before you start working on your assignment, git pull to get the latest code Each time after you are done working for a while, git add/commit/push in order to update the repository with the latest code