COS 217: Introduction to Programming SystemsGoals for Today’s ClassGoals of COS 217IntroductionsLearning the Material: Tuning InLearning the Material: BooksLearning the Material: DoingFacilities for ProgrammingWhy Debugging is Necessary…Software in COS126Software in the Real WorldGradingPoliciesIntuition: Modularity/Abstraction/InterfacesIntuition: Modularity/Abstraction/InterfacesGood Software is ModularizedSystem Interfaces/AbstractionThe C Programming LanguageThe C Programming LanguageJava vs. CJava vs. CJava vs. C, cont’dJava vs. C, cont’dJava vs. C, cont’dJava vs. C, cont’dJava vs. C, cont’dStandard Input/OutputStandard I/O in CPipes Connect Output to InputWhat’s all this good for?What’s all this good for?What’s all this good for?Formatted Output: printfFormatted Input: scanfStandard Error Handing: stderrExampleSummary1COS 217: Introduction to Programming SystemsFall 2007 (TTh 10:00-10:50 in CS 104)Prof. David I. AugustPreceptors: Bob Dondero (lead), Anirudh Badam, Lindsey Poole, Arun Raman http://www.cs.princeton.edu/courses/archive/fall07/cos217/2Goals for Today’s Class• COS 217 overview– Goals of the course– Introductions– Learning the material– Course grading– Academic policies• Getting started– Modularity/Interfaces/Abstraction– C Programming: How C differs from Java– Getting input and providing outputhttp://www.cs.princeton.edu/courses/archive/fall07/cos217/3Goals of COS 217• Understand boundary between code and computer– Machine architecture– Operating systems–Compilers• Learn C and the Unix development tools– C is widely used for programming low-level systems– Unix has a rich development environment– Unix is open and well-specified, good for study & research• Improve your programming skills– More experience in programming– Challenging and interesting programming assignments– Emphasis on modularity and debugging4Introductions• David August (professor)– Room 209 in Computer Science Building– [email protected]• Bob Dondero (lead preceptor)– Room 206 in Computer Science Building– [email protected]• Anirudh Badam, Lindsey Poole, and Arun Raman– See web site for contact info • Donna O’Leary (administrator)– Room 410 in Computer Science Building– [email protected] the Material: Tuning In•Lecture– Goal: Introduce concepts and work through examples– When: TTh 10:00-10:50 in CS 104– Slides available online at course Web site•Precept– Goal: Demonstrate tools and work through programming examples• Website - get there from: http://www.cs.princeton.edu• Mailing List at [email protected] the Material: Books• Required textbooks– C Programming: A Modern Approach, King, 1996. – The Practice of Programming, Kernighan and Pike, 1999. – ONE OF:• Online -- Programming from the Ground Up, Bartlett, 2004.• Preferred -- Computer Systems: A Programmer's Perspective, Randal E. Bryant and David R. O'Hallaron, Prentice-Hall 2003. • Highly recommended– Programming with GNU Software, Loukides and Oram, 1997.• Optional (available online)– IA32 Intel Architecture Software Developer's Manual, Volumes 1-3– Tool Interface Standard & Executable and Linking Format– Using as, the GNU Assembler• Other textbooks (on reserve in the Engineering Library)– The C Programming Language (2nd edition), Kernighan and Ritchie, 1988. – C: A Reference Manual, Harbison and Steele, 2002.– C Interfaces and Implementations, Hanson, 1996.7Learning the Material: Doing1. A “de-comment” program2. A string module3. A symbol table abstract data type (ADT) 4. A heap manager 5. UNIX commands in AI-32 assembly language 6. A buffer overrun attack 7. ???8Facilities for Programming• Recommended options: OIT “hats” LINUX cluster– Friend Center 016 or 017 computer, secure shell to “hats”, or– Your own PC, secure shell to “hats.princeton.edu” (Linux)– Why: common environment, and access to lab TAs• Other option: on your own PC (not recommended; reasonable only for some parts of some assignments):– Running GNU tools on Linux, or– Running GNU tools on Windows, or– Running a standard C development environment• Assignments are due Sundays (typically) at 9:00PM• Advice: start early, to allow time for debugging (especially in the background while you are doing other things!)…9Why Debugging is Necessary…10Software in COS126SpecificationDesignProgrammingDebuggingTesting1 Person102Lines of Code1 Type of Machine0 Spec Modifications1 Week1 Person102Lines of Code1 Type of Machine0 Spec Modifications1 Week11Software in the Real WorldSpecificationDesignProgrammingDebuggingTestingLots of People106Lines of CodeLots of MachinesLots of Spec Modifications1 Decade or moreLots of People106Lines of CodeLots of MachinesLots of Spec Modifications1 Decade or more12Grading• Seven programming assignments (60%)– Working code– Clean, readable, maintainable code– On time (penalties for late submission)• Exams (30%)–Midterm– Final• Class participation (10%)– Precept attendance is mandatory13Policieswww.cs.princeton.edu/courses/archive/fall07/cos217/policies.htmlProgramming 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 can certainly ask your friends or the teaching assistants, but do not, under any circumstances, copy another person's program. Letting someone copy your program or using someone else's code in any form is a violation of academic regulations. "Using someone else's code" includes using solutions or partial solutions to assignments provided by commercial web sites, instructors, preceptors, teaching assistants, friends, or students from any previous offering of this course or any other course.14Any questions before we start?15Intuition: Modularity/Abstraction/InterfacesClient Interface- universal remote-volume- change channel- adjust picture- decode NTSC, PALsignalsImplementation- cathode ray tube- electron gun- Sony Wega 36XBR250- 241 pounds, $2,69916Intuition:Modularity/Abstraction/InterfacesClientInterface- universal remote-volume-
View Full Document