COS 217: Introduction to Programming SystemsGoals for Today’s ClassIntroductionsCourse Goal 1: “Programming in the Large”Course Goal 2: “Under the Hood”Course Goals: Why C?Course Goals: Why Linux?Course Goals: SummaryResources: Lectures and PreceptsResources: Website and ListservResources: BooksResources: ManualsResources: Programming EnvironmentSlide 14Slide 15GradingProgramming AssignmentsWhy Debugging is Necessary…PoliciesCourse ScheduleSlide 21C vs. Java: HistoryC vs. Java: Design GoalsSlide 24Slide 25C vs. Java: OverviewC vs. Java: Overview (cont.)C vs. Java: DetailsC vs. Java: Details (cont.)Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Example C ProgramSummarySlide 38Getting Started1COS 217: Introduction to Programming SystemsProfessor Jennifer Rexfordhttp://www.cs.princeton.edu/~jrex2Goals for Today’s Class•Course overview•Introductions•Course goals•Resources•Grading•Policies•Getting started with C•C programming language overview3Introductions•Jennifer Rexford (professor)•Room 306 in Computer Science Building•[email protected] •Robert Dondero (lead preceptor)•Room 206 in Computer Science Building•[email protected]•Jailu Huang (preceptor)•Room 213 in Computer Science Building•[email protected]•Donna O’Leary (administrator)•Room 210 in Computer Science Building•[email protected] Goal 1: “Programming in the Large”•Goal 1: “Programming in the large”•Help you learn how to write large computer programs•Specifically, help you learn how to:•Write modular code•Hide information•Manage resources•Handle errors•Write portable code•Test and debug your code•Improve your code’s performance (and when to do so)•Use tools to support those activities5Course Goal 2: “Under the Hood”•Goal 2: “Look under the hood”•Help you learn what happens “under the hood” of computer systems•Specifically, two downward tours•Language levels tour•High-level language (C) → assembly language (AT&T) → machine language (IA-32)•Service levels tour•High-level language (C) → standard libraries → operating system (Linux)•Goal 2 supports Goal 1•Reveals many examples of effective abstractions6Course Goals: Why C?•Q: Why C instead of Java?•A: C supports Goal 1 better•C is a lower-level language•C provides more opportunities to create abstractions•C has some flaws•C’s flaws motivate discussions of software engineering principles•A: C supports Goal 2 better•C facilitates language levels tour•C is closely related to assembly language•C facilitates service levels tour•Linux is written in C7Course Goals: Why Linux?•Q: Why Linux instead of Microsoft Windows?•A: Linux is good for education and research•Linux is open-source and well-specified•A: Linux is good for programming•Linux is a variant of Unix•Unix has GNU, a rich open-source programming environment8Course Goals: Summary•Help you to become a...Power Programmer!!!9Resources: Lectures and Precepts•Lectures•Describe concepts at a high level•Slides available online at course Web site•Precepts•Support lectures by describing concepts at a lower level•Support your work on assignments10Resources: Website and Listserv•Website•Access from http://www.cs.princeton.edu•Course Information → COS 217•Listserv•[email protected]•Subscription is required•Instructions provided in first precept11Resources: Books•Required book•C Programming: A Modern Approach (Second Edition), King, 2008.•Covers the C programming language and standard libraries•First edition is not quite as good, but is sufficient•Highly recommended books•The Practice of Programming, Kernighan and Pike, 1999. •Covers “programming in the large”•(Required for COS 333)•Computer Systems: A Programmer's Perspective, Bryant and O'Hallaron, 2003.•Covers “under the hood”•Some key sections will be on electronic reserve•Programming with GNU Software, Loukides and Oram, 1997.•Covers tools•All books are on reserve in Engineering Library12Resources: Manuals•Manuals (for reference only, available online)•IA32 Intel Architecture Software Developer's Manual, Volumes 1-3•Tool Interface Standard & Executable and Linking Format•Using as, the GNU Assembler •See also•Linux “man” command•man – short for manual•For more help, type “man man”13Resources: Programming EnvironmentFriend Center 016 MacFriend Center 017 PChats.princeton.eduSSHLab TAsLinuxGNU•Option 1YourPgmfedorafezboater14Resources: Programming EnvironmentYour Own PC/Mac/Linux ComputerSSH•Option 2hats.princeton.eduLinuxGNUYourPgmfedorafezboater15Resources: Programming Environment•Other options•Use your own PC/Mac/Linux computer; run GNU tools locally; run your programs locally•Use your own PC/Mac/Linux computer; run a non-GNU development environment locally; run your programs locally•Etc.•Notes•Other options cannot be used for some assignments (esp. timing studies)•Instructors cannot promise support of other options•Strong recommendation: Use Option 1 or 2 for all assignments•First precept provides detailed setup instructions16Grading•Seven programming assignments (50%)•Working code•Clean, readable, maintainable code•On time (penalties for late submission)•Final assignment counts double (12.5%)•Exams (40%)•Midterm (15%)•Final (25%)•Class participation (10%)•Lecture and precept attendance is mandatory17Programming Assignments•Programming assignments1. A “decomment” program2. A string module3. A symbol table module 4. A heap manager module5. IA-32 assembly language programs6. A buffer overrun attack7. A UNIX shell •Key aspect of the course•Due (typically) Sundays at 9:00PM•First assignment is available now•Advice: Start early to allow time for debugging (especially in the background while you are doing other things!)…18Why Debugging is Necessary…19Policies•From course Policies web page:“Programming in an individual creative process much like composition. You must reach your own understanding of the problem and discover a path to its solution. During this time, discussions with friends are encouraged. However, when the time comes to write code that solves the problem, such discussions are no longer appropriate - the program must be your own work. If you have a question about how to use some feature of C, UNIX, etc., you
View Full Document