COMP 110 – INTRODUCTION TO PROGRAMMING Instructor: Jason Carter COMPUTER WORLD Hardware Operating System Program Processor Instruction (e.g. add 2 to 5) Source Code Object Code Programming Language Machine Language Programmers Library (of Code) Translator (Compilers/Interpreter) Users Disks Memory Memory Page Memory Word Memory Address Running a Program Interactive Program Non-interactive (Batch) Program Program arguments Runtime Editor Editing Programs Lexical Error Syntax Error Semantics Error Logic Error Debugging Style Principles THEATER ANALOGY Play Concert Talk Speech Cooking Lessons Town Hall Meeting THEATER WORLD – PART 1 Written in Performance Script Performance Language Management Manages Stage Performer Follows Theater Performer Performs Assists Stored in Notebook or Teleprompter Fetched from Archive Stagehand Audience Real Trial THEATER WORLD – PART 2 Written in Performance Script Writes entire script Performance Language Speaks sentence Translator (Interpreter) Translator Reads entire script Hears sentence Written in Original Script Script Language THEATER WORLD – PART 3 Reference Material Typewriter, Text Editor Word Processor, Script Writer Translator / Interpreter, Stagehand, Performer Checked by Links Syntax, Semantics, Logic, & Style Secretary Uses Script Writer Written by Original Script Problems Written in Script Language COMPUTER WORLD – PART 1 Written in Object Code Machine Language Operating System Manages Stored in Follows Memory Computer Processor Fetched from Interacts with Assists Disk, Tape Runtime Users Real Debugging COMPUTER WORLD – PART 2 Written in Object Code Writes entire source code Machine Language Writes statement Compiler Interpreter Reads source code Reads statement Written in Source Code Programming Language TRANSLATING USING BOTH A COMPLIER AND AN INTERPRETER Source Code Compiler Platform Independent Intermediate Code Interpreter Platform Specific Machine Code Processor THEATER WORLD – PART 3 Libraries Typewriter, Text Editor Editor, Programmer, Translator, Operating System Runtime, Processor Checked by Links Syntax, Semantics, Logic, & Style Linker Uses Programmer Written by Source Code Problems Written in Programming Language COMPUTER VS. THEATER Computer Hardware Operating System Program Processor Instruction (e.g. add 2 to 5) Source Code Object Code Programming Language Machine Language Programmers Library (of Code) Translator (Compilers/Interpreter) Users Disks Memory Hardware Theater Theater Theater Management Performance Performer Performance action (e.g. walk 3 steps.) Original Script Performance Script Script Language (e.g. German) Performance Language (e.g. English) Script Writers Reference Material (from Books) Translator (Before/During Performance) Audience Archival Storage Areas Script performance notebook accessible to performers Theater COMPUTER VS. THEATER Computer Memory Page Memory Word Memory Address (Page Number, Word Number) Running a Program Interactive Program Non-interactive (Batch) Program Program arguments Runtime Editor Editing Programs Lexical Error Syntax Error Semantics Error Logic Error Debugging Style Principles Theater A Notebook Page A Notebook Line Line Identification (Page Number, Line Number) Performing a Script Performance with audience participation Performance with no audience participation Special instructions at start of performance Stage-Hands Typewriter/Wordprocessor Writing Scripts Spelling Error Grammar Error Inconsistencies in Script Execution Error Staging trial performances Style Principles COMPUTER VS. THEATER CPU is fast: can do several performances at one time. CPU is dumb: no improvisation possible. Machine language much lower-level than programming language. WHY JAVA Modern, modular (object-oriented) language. Good Error Detection. Rich Library Embodying Many Good Programming Principles Can Write Teaching Tool (ObjectEditor) JAVA VERSIONS, DIALECTS & PROGRAMMING ENVIRONMENT JDK 1.5+ Eclipse IDE Programming Environment