Presentation is loading. Please wait.

Presentation is loading. Please wait.

C OMP 110 – I NTRODUCTION TO P ROGRAMMING Instructor: Prasun Dewan.

Similar presentations


Presentation on theme: "C OMP 110 – I NTRODUCTION TO P ROGRAMMING Instructor: Prasun Dewan."— Presentation transcript:

1 C OMP 110 – I NTRODUCTION TO P ROGRAMMING Instructor: Prasun Dewan

2 P REREQUISITES None

3 C OMPUTER W ORLD HardwareMemory Operating SystemMemory Page ProgramMemory Word ProcessorMemory Address Instruction (e.g. add 2 to 5)Running a Program Source CodeInteractive Program Object CodeNon-interactive (Batch) Program Programming LanguageProgram arguments Machine LanguageRuntime ProgrammersEditor Library (of Code)Editing Programs Translator (Compilers/Interpreter)Lexical Error UsersSyntax Error DisksSemantics Error Logic Error Debugging Style Principles

4 T HEATER A NALOGY Play Concert Talk Speech Cooking Lessons Town Hall Meeting

5 T HEATER W ORLD – P ART 1 Performer Theater Performer Stage Audience Performs RealTrial Performance Script Follows Performance Language Written in Notebook or Teleprompter Stored in Archive Fetched from Stagehand Assists Management Manages

6 T HEATER W ORLD – P ART 2 Performance Script Performance Language Written in Original Script Script Language Written in Translator Translator (Interpreter) Writes entire script Reads entire script Speaks sentence Hears sentence

7 T HEATER W ORLD – P ART 3 Original Script Script Language Written in Script Writer Written by Typewriter, Text Editor Uses Secretary Reference Material Links Syntax, Semantics, Logic, & Style Problems Checked by Word Processor, Script Writer Translator / Interpreter, Stagehand, Performer Word Processor, Script Writer Translator / Interpreter, Stagehand, Performer

8 C OMPUTER W ORLD – P ART 1 Processor Computer Users Interacts with RealDebugging Object Code Follows Machine Language Written in Memory Stored in Disk, Tape Fetched from Runtime Assists Operating System Manages

9 C OMPUTER W ORLD – P ART 2 Object Code Machine Language Written in Source Code Programming Language Written in Compiler Interpreter Writes entire source code Reads source code Writes statement Reads statement

10 Processor Compiler Interpreter Source Code Platform Independent Intermediate Code Platform Specific Machine Code T RANSLATING U SING B OTH A C OMPLIER AND A N I NTERPRETER

11 T HEATER W ORLD – P ART 3 Source Code Programming Language Written in Programmer Written by Typewriter, Text Editor Uses Linker Libraries Links Syntax, Semantics, Logic, & Style Problems Checked by Editor, Programmer, Translator, Operating System Runtime, Processor Editor, Programmer, Translator, Operating System Runtime, Processor

12 C OMPUTER VS. T HEATER ComputerTheater HardwareTheater Operating SystemTheater Management ProgramPerformance ProcessorPerformer Instruction (e.g. add 2 to 5)Performance action (e.g. walk 3 steps.) Source CodeOriginal Script Object CodePerformance Script Programming LanguageScript Language (e.g. German) Machine LanguagePerformance Language (e.g. English) ProgrammersScript Writers Library (of Code)Reference Material (from Books) Translator (Compilers/Interpreter)Translator (Before/During Performance) UsersAudience DisksArchival Storage Areas MemoryScript performance notebook accessible to performers HardwareTheater

13 C OMPUTER VS. T HEATER ComputerTheater Memory PageA Notebook Page Memory WordA Notebook Line Memory Address (Page Number, Word Number) Line Identification (Page Number, Line Number) Running a ProgramPerforming a Script Interactive ProgramPerformance with audience participation Non-interactive (Batch) ProgramPerformance with no audience participation Program argumentsSpecial instructions at start of performance RuntimeStage-Hands EditorTypewriter/Wordprocessor Editing ProgramsWriting Scripts Lexical ErrorSpelling Error Syntax ErrorGrammar Error Semantics ErrorInconsistencies in Script Logic ErrorExecution Error DebuggingStaging trial performances Style Principles

14 C OMPUTER VS. T HEATER CPU is fast: can do several performances at one time. CPU is dumb: no improvisation possible. Machine language much lower-level than programming language.

15 W HY J AVA Modern, modular (object-oriented) language. Good Error Detection. Rich Library Embodying Many Good Programming Principles Can Write Teaching Tool (ObjectEditor)

16 J AVA V ERSIONS, D IALECTS & P ROGRAMMING E NVIROMNET JDK 1.5+ Eclipse IDE Programming Environment Will not matter

17 C OMPUTER VS. P ROGRAM M ODEL Processor Compiler Program (source code)

18 S TRUCTURING IN S CRIPTS Script Performer Theater Follows

19 S TRUCTURING IN S CRIPTS Script Introduction Body Conclusion Paragraph 1 Paragraph 2 Sentence 1Sentence 2 Script components are abstract. So are program components!

20 C OMPUTER VS. P ROGRAM M ODEL Processor Compiler Program (source code)

21 O UTLINE Intuitive Explanation Two Concrete Examples Calculators square BMI Basic Java program elements, programming styles, error handling Running and interacting with a Java program

22 S TRUCTURING IN S CRIPTS Script Performer Theater Follows

23 S TRUCTURING IN S CRIPTS Script Introduction Body Conclusion Paragraph 1 Paragraph 2 Sentence 1Sentence 2 Script components are abstract. So are program components! Next chapter discusses abstract program components


Download ppt "C OMP 110 – I NTRODUCTION TO P ROGRAMMING Instructor: Prasun Dewan."

Similar presentations


Ads by Google