Recitation 1: Intro, Revision Control, Project 1 Hints Vinay Chaudhary, Michael Ashley-Rollman Most borrowed from Dave Anderson CMU Computer Science Spring.

Slides:



Advertisements
Similar presentations
Week 2 DUE This Week: Safety Form and Model Release DUE Next Week: Project Timelines and Website Notebooks Lab Access SharePoint Usage Subversion Software.
Advertisements

Version Control System (Sub)Version Control (SVN).
Version Control System Sui Huang, McMaster University Version Control SystemSui Huang, McMaster University Version Control System -- base on Subversion.
Practical software engineering: Revision control & make Spring 2010, Recitation #2.
2/6/2008Prof. Hilfinger CS164 Lecture 71 Version Control Lecture 7.
Using subversion COMP 2400 Prof. Chris GauthierDickey.
Source Code Revision Control with Subversion Christophe Dupré May 13, 2005 Update KEJ May 10, 2006 Scientific Computation Research Center Rensselaer Polytechnic.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
CVS II: Parallelizing Software Development Author: Brian Berliner John Tully.
Low level CASE: Source Code Management. Source Code Management  Also known as Configuration Management  Source Code Managers are tools that: –Archive.
Today Rest of the demos (no escape!) Now that you tried group work without version control, making your life easier WITH it. You all got groups for #2?
Source Code Management Or Configuration Management: How I learned to Stop Worrying and Hate My Co-workers Less.
1 CMPT 275 Software Engineering Revision Control.
Source Control Repositories for Enabling Team Working Svetlin Nakov Telerik Corporation
G51FSE Version Control Naisan Benatar. Lecture 5 - Version Control 2 On today’s menu... The problems with lots of code and lots of people Version control.
Version Control. What is Version Control? Manages file sharing for Concurrent Development Keeps track of changes with Version Control SubVersion (SVN)
Recitation 1: Intro & Revision Control Dave Andersen CMU Computer Science Fall 2006.
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
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.
The Linux Operating System Lecture 7: Tonga Institute of Higher Education.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
Version Control with Subversion Quick Reference of Subversion.
1 Lecture 19 Configuration Management Software Engineering.
1 Software Development Configuration management. \ 2 Software Configuration  Items that comprise all information produced as part of the software development.
Git – versioning and managing your software L. Grewe.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: minutes “Unix is user-friendly. It's just very selective about.
Object-Oriented Software Engineering Using UNIX groups and CVS Estimated Time: minutes.
Version control Using Git Version control, using Git1.
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Chris Onions Getting started with CVS in ATLAS 11 Getting started with CVS in ATLAS Chris Onions (Tutorial based on that of Raúl Ramos Pollán CERN / IT.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
(Sub)Version Control. 2 Keep large teams working on the same code Back up your work so you don't lose it all Compare changes to previous versions Revert.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
SENG 403 Tutorial 1 1SENG 403 – Winter Agenda Version Control Basics Subversion Basic actions in Subversion Some examples 2SENG 403 – Winter 2012.
Computer Science and Engineering The Ohio State University  Widely used, especially in the opensource community, to track all changes to a project and.
CSE 219 Computer Science III CVS
Introduction to Version Control with Git CSC/ECE 517, Fall 2014 A joint project of the CSC/ECE 517 staff, including Titus Barik, Gaurav Tungatkar, Govind.
1 CSE306 Operating Systems Projects CVS/SSH tutorial.
Week 3 January 22, 2004 Adrienne Noble. Today CVS – a great tool to use with your groups Threads – basic thread operations Intro to synchronization Hand.
12 CVS Mauro Jaskelioff (originally by Gail Hopkins)
Version Control and SVN ECE 297. Why Do We Need Version Control?
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Daniel Spangenberger Computer Networks, Fall 2007.
CS 241 Section Week #1 January 26, Topics This Section HW #1 SVN Review (…by the command line!) C Code Examples.
TEAM FOUNDATION VERSION CONTROL AN OVERVIEW AND WALKTHROUGH By: Michael Mallar.
Basics of the Domain Name System (DNS) By : AMMY- DRISS Mohamed Amine KADDARI Zakaria MAHMOUDI Soufiane Oujda Med I University National College of Applied.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Corporation
Using Subversion for Source Code Control Michael McLennan HUBzero® Platform for Scientific Collaboration Purdue University This work licensed under Creative.
1 Subversion Kate Hedstrom April Version Control Software System for managing source files –For groups of people working on the same code –When.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
Problem Solving With C++ SVN ( Version Control ) April 2016.
Source Control Dr. Scott Schaefer. Version Control Systems Allow for maintenance and archiving of multiple versions of code / other files Designed for.
Information Systems and Network Engineering Laboratory II
Version Control with Subversion
SVN intro (review).
Source Control Dr. Scott Schaefer.
Discussion 11 Final Project / Git.
Subversion Reasons to use How it works Subversion important commands
CSE 303 Concepts and Tools for Software Development
Concurrent Version Control
Version Control System
slides borrowed and adapted from Alex Mariakis and CSE 390a
Introduction to Version Control with Git
Prof. Hilfinger CS164 Lecture 4
Systems Analysis and Design I
Presentation transcript:

Recitation 1: Intro, Revision Control, Project 1 Hints Vinay Chaudhary, Michael Ashley-Rollman Most borrowed from Dave Anderson CMU Computer Science Spring 2007

Overview Recitation Mechanics Thoughts & Advice Makefiles Source Control Project Hints Partners?

Recitation Mechanics 1) These are your recitations. –We’re here to help –We’ve got a schedule. It’s flexible. –Ask questions, make comments, … –1 part lecture, 1 part “public office hours” (homework questions? Sure! Project questions? Great!) 2) These aren’t the final answers –Recitations culled from our experience, other faculty, friends in industry, books, etc. –We’re always looking for better ideas/tools/practices/etc. If you have some, please share.

Thoughts & Advice

Systems Software Low-level (projects in C) Designed to run forever –Handle every possible error condition –Manage resources carefully Must be secure! –The Internet is not a friendly place Based on documented protocols

Quite different from 213 Project size: 1000s of lines vs 100s. Project duration: 5 weeks vs 1-2 weeks Partners vs. solo developer Result: –You can’t keep the “state” for 441 projects in your head at all times. It’s too big! –Requires one step more care in development.

Software Engineering For Systems Hackers Goals and foundations: –1-5 developers –Context: Systems code, but not too much is systems specific –Very low overhead and up-front cost Like to see benefits w/in a single project

Our Philosophy Your time is valuable and limited Some things are fun: –Design, initial coding, a working project Some things are less fun: –Agonizing debugging, bad project grades, spending 10x longer than you thought Use techniques that minimize time and maximize fun vs less fun.

Partly-free lunch Techniques take a bit of time to learn –E.g., make files, revision control software (today) –But they will pay off! Some techniques take a bit more up-front time –E.g., writing good log messages, thinking about design, good debugging capabilities –But they make the rest of the project more predictable and reduce the uncertainty of failing in the last day. –(And they save debugging time).

Your job Ask yourself: “Could I be doing this in a more efficient way?” –Typing “gcc –g –Wall foo.c bar.c baz.c” vs typing “make” Debugging: “Have I seen this bug before? What caused it? How could I avoid it?” –Be reflective; strive to learn & improve.

In Practice: Algorithms Most systems programs need: –Hashes, linked lists –Searching and sorting For many, that’s it. –(Databases are different) Given this, –What would a good, lazy programmer do?

Don’t write it twice Hashes/lists: Have a nice implementation that you reuse. –We suggest either the ones from “The Practice of Programming” Or rip them out of the BSD kernel This is perfectly acceptable in 441 Sorting: Don’t write at all! –C library “qsort” (heap, merge…)

Don’t prematurely optimize If it ain’t slow, don’t break it Keep your programs simple –Easier to write –Easier to debug But make it easy to change implementation details –Modularity! (Later lecture)

Optimizing your time Sorting 3 numbers: Do it by hand Sorting 3000 numbers: Do it in ruby Sorting 300,000,000,000 numbers: Write some serious code Mental calculation –Time spent doing task –Time spent automating/optimizing –Will you have to do this again?

Resources Some great books: –The Pragmatic Programmer –The Practice of Programming –Writing Solid Code Recitation notes: –On the course website

Makefiles

Makefiles – Example1 smtpverify: verf.c smtp.c gcc -Wall -Werror verf.c smtp.c -o smtpverify -lresolv smtpsend: send.c smtp.c gcc -Wall -Werror send.c smtp.c -o smtpsend -lresolv clean: rm -f *~ smtpverify smtpsend

VERFOBJS = verf.o smtp.o SENDOBJS = send.o smtp.o LIBS = -lresolv CC = gcc CFLAGS = -Wall -Werror.PHONY: all clean all: smtpverify smtpsend clean: rm -f *.o *~ smtpverify smtpsend cscope.out output.ps smtpverify: $(VERFOBJS) $(CC) $(CFLAGS) $(VERFOBJS) -o smtpverify $(LIBS) smtpsend: $(SENDOBJS) $(CC) $(CFLAGS) $(SENDOBJS) -o smtpsend $(LIBS) Makefiles – Example2

Source Control

Revision Control Before you write a line of code… Use subversion/CVS/etc. Provides access to all old versions of your code –No more “cp file.c file.c am-oh-god-please-let-this-work”

What is revision control? A repository that stores each version You explicitly “check out” and “check in” code and changes. 597 bark:~/tmp> svn checkout A systems-se/related.tex A systems-se/acks.tex A systems-se/tinylang.tex A systems-se/emacs.tex ….

Why do I want it? Super-undo: Go to arbitrary versions –rm –rf your source tree? No problem! Tracking changes /“why did this break?” Concurrent development Snapshots –Turning in the assignment: just make a snapshot when you want, and we’ll grade that. You can keep developing afterwords. –Useful, e.g., for optimization contest, or for making sure you have something working.

The repository Master copy of code is separate from what you work on You can have multiple working copies checked out. (So can your partner) Repository Your working copy Partner working copy Laptop working copy

Check out and commit Explicitly synchronize with the repository Repository Your working copy Checkout / Update Commit

First Version Older Version 2 Older Version 1 Every revision is available Current version

And you can see what changed Revision control lets you note (and then see) what you changed: > svn log gtcd.cc r986 | ntolia | :13: (Tue, 01 Aug 2006) | 6 lines This allows the sp to get rid of chunks early before a transfer is complete. Useful when a file is requested in-order and the file size > mem cache size And makes it easy to go back to other versions: r987 | ntolia | :16: (Wed, 02 Aug 2006) | 1 line After much thought, I am reverting the last patch. We will need to revisit the issue when we think about DOT on storage-limited clients

Concurrent Development Each person checks out a copy Both can work at the same time without (much) fear of clobbering the other –Changes only visible on commit/update What if both people edit the same file and commit it?

Concurrent edits Ann Drew File v1 Both check out file Edits (ann-1) File v2 Edits (drew-1) Different part of same file commit Update Successfully merged

Concurrent edits Ann Drew File v1 Both check out file Edits (ann-1) File v2 Edits (drew-1) Overlap with ann-1 commit Update (CONFLICT)

Resolving Conflicts Subversion will give you 3 files: –The original with conflict markers –The version you were editing –The latest version in the repository You can: –Keep your changes, discarding others –Toss your changes –Manually resolve After finishing resolving, type svn resolved

Branches Multiple paths of development, e.g. –Release 1.0 only gets security patches –“Development” branch gets everything “tags” or “snapshots” –Save a good known state. E.g., for handing in. Issue of merging

Subversion svn checkout (co) svn commit svn update svn add svn mkdir svn copy: create a branch or snapshot svn diff: See difference between versions by default: between what you started on and where you are now

Reverting To remove all changes from a file and sync to the latest repository version, type svn revert. To revert a file to a previous repository version (after you've checked it in), type svn merge -r HEAD:old_version then svn commit

Brief walkthrough > svn checkout se A systems-se/acks.tex … > cd systems-se > echo “new file” >> test.txt > svn add test.txt A test.txt > svn commit [svn will open an editor for log message] Adding test.txt Transmitting file data.. Committed revision 21.

Thoughts on Revision Control Update, make, test, then commit Update out of habit before you start editing Merge often Commit format changes separately Check svn diff before committing Try not to break the checked in copy –Invasive changes? Maybe a branch Don’t use svn lock Avoid conflicts by good decomposition (modularity) and out-of-band coordination

Go forth and revise! Revision control will save you untold pain –Most people I know have accidentally nuked files or entire directories –Logs and diffs very useful for finding bugs –Much better way to coordinate with partners (but useful on your own! I use it for almost everything) Very small investment to learn Try it on your own! Read the SVN book online for more info:

Project Hints

Project 1: Update smtpverify and smtpsend now take an smtp-server argument –Allows forwarding mail through a machine Ie: using courseweb.sp.cs.cmu.edu to send mail to andrew.cmu.edu –The project webpage is updated to reflect this

Project 1 Hints : DNS The trickiest part may be getting the mail server ip address. –DNS contains multiple records Address (A) Mail Exchange (MX) Name Servers (NS) Etc –Queries return A records by default, but we need MX records Can’t simply use gethostbyname() Can use resolver

Project 1 Hints : DNS int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen); –dname is the domain name to lookup –class is usually C_IN (internet) –type is desired record (T_A, T_MX, T_NS, etc) –answer is not straight forward Parse with ns_initparse, ns_parserr, ns_rr_rdata, ns_get32

Project 1 Hints : DNS Use resolver (man resolver). Very poorly documented –Some documentation here: exchange.com/Programming/Programming_Languages/C/Q_ html Look at the arpa/nameser.h (/usr/include/arpa) file for definitions. Try dig for testing out dns lookups (man dig)

Project 1 Hints : Other telnet to port 25 on courseweb.sp.cs.cmu.edu and experiment Make sure command messages end with \r\n. –The actual should end with \r\n.\r\n Be careful with TCP streams. –Calling tcp send/recv does not always guarantee sending/receiving the entire packet. Try putting it in a loop. –Once read is in a loop, there needs to be some way of deciding when to stop reading, can’t just block forever Start early Have fun

Project 1 Hints: Websites exchange.com/Programming/Programming_Languages/C/Q_ html

Partners