170 likes | 182 Views
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? Do "can n on powershot " cameras sell for more or less? Or is Google auto-correct fixing things?
E N D
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? • Do "cannon powershot" cameras sell for more or less? Or is Google auto-correct fixing things? • Are people as dumb/stupid/lazy as we fear? • Are URL shorteners and sessions on the URL killing the web? • How much is easy to help vs. where does it get harder to make big leaps in functionality?
Demos! Demo Tips (Giving) • don't worry if something breaks, just explain how it "usually" works • don't be nervous, no reason to be even if it all blows up • do explain why it's cool/different/what you learned Demo Tips (Viewing): Give CONSTRUCTIVE criticism • Things you like (why?) • Things that users would be confused by • Ways they could have made their life easier when building it
General JS Advice Good • $('#myElement').text('Hello'); • $('#myElement').css('color', 'red'); • $('#myElement').fadeIn(); Better • $('#myElement').text('Hello').css('color', 'red').fadeIn(); Beauuutiful • $('#myElement').text('Hello') .css('color', 'red') .fadeIn();
General JS Advice Objects are ok. Literals are better. var s = new String(); var s = ''; var a = new Array(); var a = []; var o = new Object(); var o = {}; var re = new RegExp(); var re = /…/;
For…In will bite you Avoid for ... in to loop over arrays // Use a plain for loop or the jQuery .each method for (var i=0; i < myArray.length; i++) { myArray[i]; }; $(myArray).each(function() { this; });
Better Comments • Give your high-level thinking • If we deleted everything but the comments, could we get your top-level functional goals (that of course you sketched out first) • (Overall, pretty good this year.)
How would you sync a remote team? … if you were asked to design a way right now. • Need visibility into history. • Who changed what? • Everyone wants to code at once – do they get to? • File "read-only" locking? • Having a passed "I own the master copy"?
Version Control Company_report_2011.08.01.xls Company_report_2011.08.02b_chuck.xls Company_report_2011.08.05_feedback.xls Company_report_2011.08.11.xls "Hey did you see my latest changes in my email?" … evil. Impossible to stop. Totally counts. Bonus points for seeing live updates from other people.
Centralized vs. Distributed http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/
Centralized vs. Distributed Perfect for lab-lab.
… but let's do Centralized • The server is the "truth" • You save your changes to the file on your computer. Then you "check in" your changes to the server. • Only gets complicated if two people working on the same stuff at the same time, so minimize that by having smaller files (like your JavaScript in a .js file, CSS in a .css file etc) • Could even have a few files!
SVN – poke at it as you listen • All: Command Line, RapidSVN • OSX: Versions, svnX • Windows: TortoiseSVN • IDEs (All): Eclipse, Netbeans, TextMate • Pick one, download it, start poking at it. • New? RapidSVN. • Experienced on Mac? "sudo port install subversion" and go command-line.
Don't Break Everything Actually, that's the point of version control – if you do, we can roll back, AND we know who broke it! • https://svn.ischool.berkeley.edu/iolab11
Vocabulary Basic Setup • Repository (repo): The database storing the files. • Server: The computer storing the repo. • Client: The computer connecting to the repo. • Working Set/Working Copy: Your local directory of files, where you make changes. • Trunk/Main: The primary location for code in the repo. Think of code as a family tree — the trunk is the main line. Basic Actions • Add: Put a file into the repo for the first time, i.e. begin tracking it with Version Control. • Revision: What version a file is on (v1, v2, v3, etc.). • Head: The latest revision in the repo. • Check out: Download a file from the repo. • Check in: Upload a file to the repository (if it has changed). The file gets a new revision number, and people can “check out” the latest one. • Checkin Message: A short message describing what was changed. • Changelog/History: A list of changes made to a file since it was created. • Update/Sync: Synchronize your files with the latest from the repository. This lets you grab the latest revisions of all files. • Revert: Throw away your local changes and reload the latest version from the repository. http://betterexplained.com/articles/a-visual-guide-to-version-control/
More Vocabulary • Branch • Tag • Peg • More. • (But you don't really care right now)
Save yourself the headache • Always update before you commit. • Write something meaningful for your commit message. • You must use the add command to add files in your working copy to the repository. • Don't overlay "more" revision control – files like "image_v01.png image_c02.png etc"
For Next Time • Project 2 Demos! • Mobile!