CISC/CMPE320 - Prof. McLeod

Slides:



Advertisements
Similar presentations
Source Control Repositories for Enabling Team Working Svetlin Nakov Telerik Corporation
Advertisements

Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Sumedha Rubasinghe October,2009 Introduction to Programming Tools.
Introduction to Version Control
Source Control Repositories for Team Collaboration: SVN, TFS, Git.
Version Control with Subversion Quick Reference of Subversion.
Git – versioning and managing your software L. Grewe.
Version control Using Git Version control, using Git1.
…using Git/Tortoise Git
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at and slides written.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Version Control Systems. Version Control Manage changes to software code – Preserve history – Facilitate multiple users / versions.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Project Wikis are private again. Assignment 3 is posted. Due Nov. 6. SDD framework must be in place.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Today: –Review declaration, implementation, simple class structure. –Add an exception class and show.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 3 is due Sunday, the 8 th at 7pm. Problems with assn 3? Discuss at your team meeting tonight.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 4 is due Nov. 20 (next Friday). SDD document framework should be set up in your Wiki by now.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 3 is due Sunday, the 8 th at 7pm. Today: –Two simple binding examples. –Function Hiding.
Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Corporation
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Anjana & Shankar September,2010 Introduction to Programming Tools.
CompSci 230 Software Construction
CS5220 Advanced Topics in Web Programming Version Control with Git
Stack and Heap Memory Stack resident variables include:
Information Systems and Network Engineering Laboratory II
Version Control with Subversion
SVN intro (review).
LECTURE 2: Software Configuration Management
Version control, using Git
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Run-time organization
CISC/CMPE320 - Prof. McLeod
Concurrent Version Control
CISC/CMPE320 - Prof. McLeod
Version Control System
Akshay Narayan git up to speed with RCS Akshay Narayan
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
Source Code Management
Version Control with git
LECTURE 3: Software Configuration Management
Design and Programming
CISC101 Reminders Slides have changed from those posted last night…
Memory Allocation CS 217.
Git CS Fall 2018.
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC124 Labs start this week in JEFF 155. Fall 2018
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC/CMPE320 - Prof. McLeod
CISC101 Reminders All assignments are now posted.
Systems Analysis and Design I
CMPE212 – Reminders Assignment 2 due today, 7pm.
CMPE212 – Reminders Assignment 2 due next Friday.
Introduction to The Git Version Control System
SPL – PS1 Introduction to C++.
Topic 2b ISA Support for High-Level Languages
Using GitHub for Papyrus Models Jessie Jewitt – OAM Technology Consulting/ ARM Inc. January 29th, 2018.
Presentation transcript:

CISC/CMPE320 - Prof. McLeod Winter 2013 CISC/CMPE320 2/19/2019 CISC/CMPE320 Assignment 2 due today, 7pm. RAD marking is underway. You will get feedback in an Issue. Fall 2018 CISC/CMPE320 - Prof. McLeod Prof. Alan McLeod

CISC/CMPE320 - Prof. McLeod Today Finish Repositories. Namespaces. Introduce the Heap. Fall 2018 CISC/CMPE320 - Prof. McLeod

Last Time: Git Repository Terms Commit Update Version control Index or cache or “staging area” Working directory Local repository Clone Add Snapshot Push Fetch Merge Merge conflict Conflict resolution Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Git Branching Features can be developed in an isolated way by creating a branch. Eventually it will merge back to the “master” branch. A branch is a subset of source code files that are needed just for one particular task. Fall 2018 CISC/CMPE320 - Prof. McLeod

Repositories in Use, Cont. You need a server, we have Bitbucket. Or (if you were not in this class) you could use a cloud-based server. And local client software. Such as “GitKraken”, “SourceTree” or “SmartGit”, etc. Many others, or your IDE (like Eclipse or Visual Studio) will have a git client built right into it. Also popular: GitLab and GitHub. Fall 2018 CISC/CMPE320 - Prof. McLeod

From Before: Bitbucket If you are using a git client the URL will be in the form: http://jira.caslab.queensu.ca:7990/scm/@@/####repo.git Where “@@” is your project key and “####” is your team name in lower case. For example, for team Aberdeen: http://jira.caslab.queensu.ca:7990/scm/ta/aberdeenrepo.git You will still need to supply your username and password to access your repository. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Conflicts What happens when two people commit the same file? Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Resolving Conflicts How to prevent? Option 1: only allow one person to have a writeable copy at any time (lock the file). This is called pessimistic concurrency or lock, modify, unlock. Used in Microsoft Visual SourceSafe. Option 2: let people edit, and resolve conflicts afterward by merging files. Called optimistic concurrency or copy, modify, merge. “It's easier to get forgiveness than permission”. Most modern systems (including Subversion) do this. Fall 2018 CISC/CMPE320 - Prof. McLeod

Resolving Conflicts, Cont. Using Git “terminology”: Hermione attempts a push, but Ron has done a push after Hermione has fetched (or cloned). Hermione’s push will be rejected, even if she has not changed the same files that Ron has changed. Hermione must do a fetch and merge to get Ron’s changes before she can push. Ron’s changes will be applied and then Hermione’s changes will be re-applied. Fall 2018 CISC/CMPE320 - Prof. McLeod

Resolving Conflicts, Cont. It may be that changes do not overlap, so a merge will work automatically, but if there is a conflict: The resolution process allows one person to view a merged file, with the differences marked. This person decides which revisions to keep/discard. Only works for text files, not binary files. If more than two people submit the same file – then the project needs better management… Fall 2018 CISC/CMPE320 - Prof. McLeod

Conflict Resolution, Cont. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Repositories, Cont. Note that not only are file changes tracked and recorded but directory structure changes are also monitored. Always add a comment when you commit noting your changes in a general way and why you made those changes. Was this a response to a bug fix, for example? Did you run your unit tests on your code before you committed? Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod How to Use Git, Cont. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Namespaces We’ve been using namespace std; for a while now. Without it, you would need to write: std::cout << something << std::endl; A simple mechanism to avoid naming conflicts. A class can have the same name as long as it is in a different namespace. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Namespaces, Cont. To place your class definitions in a namespace, simply name it: namespace alpha { class dingdong { … }; } Now dingdong can be defined in another namespace (like std) and there will not be a conflict. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Namespaces, Cont. Particularly useful when you are building a library of classes. You will want to make sure your namespace’s name is unique. You can use an alias to make this easier: namespace alpha = Alpha_Software_Company; Now the user of your library, just needs to type: alpha::someThing(); Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Namespaces, Cont. The only namespace that you should identify with the using keyword is std. All other namespaces should be named in the statement, like alpha::. Then you won’t conflict with anything in the std namespace. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Nested Namespaces C++17 Now, you can declare a namespace inside another namespace: namespace A { namespace B { namespace C { //… } Or you could just do: namespace A::B::C { Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Memory Categories Code: Machine instructions for all member and non-member functions. Code is read from memory and executed. Static Data: All global variables and static local variables and static class data members. Run-time Stack: Used by most variables. All local, non-static variables. Free Store or Heap: Used when variables are created using the new or new[] keywords. Fall 2018 CISC/CMPE320 - Prof. McLeod

Memory Categories, Cont. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Stack vs. Heap Memory The stack is a fixed size amount of RAM consisting of sequential addresses. (1 to 100MB) Every time a function is invoked a frame is pushed on top of the stack. The frame contains: Function arguments. Local variables. The code memory location for the instruction that invoked the function. Another code instruction counter. A memory location waiting to accept other return values. Fall 2018 CISC/CMPE320 - Prof. McLeod

Aside – Changing Stack Size Default is about 2MB. Lots – unless you create large arrays on the stack (why?) or you are doing a lot of recursion. To increase add the following to the “miscellaneous” linker command line options: -Wl,--stack,<size> <size> is in bytes. This assumes gcc/mingw on Windows. (I have not tried this…) Fall 2018 CISC/CMPE320 - Prof. McLeod

Aside – Changing Stack Size, Cont. A larger stack is not always a good idea: You might have many threads running, each with their own large stack. A stack must be contiguous. A larger stack will take longer to demonstrate memory problems such as infinite recursion. Using a larger stack probably means you are not using the heap to your advantage. Fall 2018 CISC/CMPE320 - Prof. McLeod

Stack vs. Heap Memory, Cont. When a function completes, the frame is popped off the stack (effectively, a stack pointer which contains the address of the top frame on the stack is moved to the frame below the frame that finished). The next frame, resulting from another function call, overwrites some or all of the memory from the old frame (and the stack pointer is moved up to the new frame). Fall 2018 CISC/CMPE320 - Prof. McLeod

Stack vs. Heap Memory, Cont. This does not happen with heap memory. Objects in the heap persist and you must delete them! Heap memory is only limited by the amount of RAM that can be obtained by your OS. Addresses are not necessarily sequential. If you run out of RAM in your heap, then you may start using a swap file (yuk!). Stack overflow is common – when you run out of stack memory. But the heap is huge!! No overflow problems. But you might have a memory leak problem instead! Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Heap Memory You don’t always know until run-time how big an object will need to be. It might be huge! You may not be able to use (or may not want to use) a global, but need to have a variable that persists beyond a function’s completion. This memory is allocated when you use the new operator. The new operator provides dynamic memory allocation – a “memory allocator” process supplies the address of a heap storage location. You must use a pointer to refer to something on the heap. The pointer will be on the stack. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Returning a Pointer If you create a local object on the heap in a function then you can return a pointer to that object and it will persist. Much better than returning a reference to a local object! A local object may be stable for a while, but eventually the memory it occupies will get totally or partially overwritten by another function call. Fall 2018 CISC/CMPE320 - Prof. McLeod

CISC/CMPE320 - Prof. McLeod Heap Memory To return memory to the heap, you must use the delete operator. To free up an array, use delete[]. Supply a pointer to the operator. When you use new to create an array the size does not have to be known until run time: double* arr = new double[arraySize]; The pointer arr will reside on the run-time stack, but the array structure will be on the heap. Fall 2018 CISC/CMPE320 - Prof. McLeod