comp 110 – introduction to programming

15
COMP 110 – INTRODUCTION TO PROGRAMMING Instructor: Jason Carter

Upload: marek

Post on 24-Feb-2016

41 views

Category:

Documents


0 download

DESCRIPTION

Comp 110 – Introduction to Programming. Instructor: Jason Carter. Computer World. Theater Analogy. Play Concert Talk Speech Cooking Lessons Town Hall Meeting. Fetched from. Management. M anages. Theater. Performer. A ssists. Stagehand. Real. Trial. Archive. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Comp 110 – Introduction to Programming

COMP 110 – INTRODUCTION TO PROGRAMMING

Instructor: Jason Carter

Page 2: Comp 110 – Introduction to Programming

COMPUTER WORLDHardware MemoryOperating System Memory PageProgram Memory WordProcessor Memory Address Instruction (e.g. add 2 to 5) Running a ProgramSource Code Interactive ProgramObject Code Non-interactive (Batch) ProgramProgramming Language Program argumentsMachine Language Runtime Programmers EditorLibrary (of Code) Editing ProgramsTranslator (Compilers/Interpreter) Lexical ErrorUsers Syntax Error Disks Semantics Error

Logic ErrorDebuggingStyle Principles

Page 3: Comp 110 – Introduction to Programming

THEATER ANALOGY Play Concert Talk Speech Cooking Lessons Town Hall Meeting

Page 4: Comp 110 – Introduction to Programming

THEATER WORLD – PART 1

Performer

Theater

Performer

Stage

Audience

Performs

Real Trial

Performance Script

Follows

Performance Language

Written in

Notebook or Teleprompte

r

Stored in

Archive

Fetched from

StagehandAssists

ManagementManages

Page 5: Comp 110 – Introduction to Programming

THEATER WORLD – PART 2Performance

ScriptPerformance

LanguageWritten in

Original ScriptScript

LanguageWritten in

Translator Translator (Interpreter)

Writes entire script

Reads entire script

Speaks sentence

Hears sentence

Page 6: Comp 110 – Introduction to Programming

THEATER WORLD – PART 3

Original ScriptScript

LanguageWritten in

Script Writer

Written by

Typewriter, Text Editor

UsesSecretary

Reference Material

LinksSyntax, Semantics,

Logic, & Style

Problems

Checked by

Word Processor, Script Writer

Translator / Interpreter,Stagehand, Performer

Page 7: Comp 110 – Introduction to Programming

COMPUTER WORLD – PART 1

Processor

Computer

Users

Interacts with

Real Debugging

Object Code

Follows

Machine Language

Written in

Memory

Stored in

Disk, Tape

Fetched from

RuntimeAssists

Operating System

Manages

Page 8: Comp 110 – Introduction to Programming

COMPUTER WORLD – PART 2Object Code

Machine Language

Written in

Source CodeProgramming Language

Written in

Compiler Interpreter

Writes entire

source code

Reads source code

Writes statement

Reads statement

Page 9: Comp 110 – Introduction to Programming

Processor

Compiler

Interpreter

Source Code

Platform Independent

Intermediate Code

Platform Specific Machine Code

TRANSLATING USING BOTH A COMPLIER AND AN INTERPRETER

Page 10: Comp 110 – Introduction to Programming

THEATER WORLD – PART 3

Source CodeProgramming Language

Written in

Programmer

Written by

Typewriter, Text Editor

UsesLinker

Libraries

LinksSyntax, Semantics,

Logic, & Style

Problems

Checked by

Editor, Programmer, Translator, Operating

System Runtime, Processor

Page 11: Comp 110 – Introduction to Programming

COMPUTER VS. THEATERComputer Theater

Hardware TheaterOperating System Theater ManagementProgram PerformanceProcessor PerformerInstruction (e.g. add 2 to 5) Performance action (e.g. walk 3

steps.)Source Code Original ScriptObject Code Performance ScriptProgramming Language Script Language (e.g. German)Machine Language Performance Language (e.g.

English)Programmers Script WritersLibrary (of Code) Reference Material (from Books)Translator (Compilers/Interpreter) Translator (Before/During

Performance)Users AudienceDisks Archival Storage AreasMemory Script performance notebook

accessible to performersHardware Theater

Page 12: Comp 110 – Introduction to Programming

COMPUTER VS. THEATERComputer Theater

Memory Page A Notebook PageMemory Word A Notebook LineMemory Address (Page Number, Word Number)

Line Identification (Page Number, Line Number)

Running a Program Performing a ScriptInteractive Program Performance with audience

participationNon-interactive (Batch) Program Performance with no audience

participationProgram arguments Special instructions at start of

performanceRuntime Stage-HandsEditor Typewriter/WordprocessorEditing Programs Writing ScriptsLexical Error Spelling ErrorSyntax Error Grammar ErrorSemantics Error Inconsistencies in ScriptLogic Error Execution Error Debugging Staging trial performancesStyle Principles Style Principles

Page 13: Comp 110 – Introduction to Programming

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.

Page 14: Comp 110 – Introduction to Programming

WHY JAVA Modern, modular (object-oriented) language. Good Error Detection. Rich Library Embodying Many Good

Programming Principles Can Write Teaching Tool (ObjectEditor)

Page 15: Comp 110 – Introduction to Programming

JAVA VERSIONS, DIALECTS & PROGRAMMING ENVIRONMENT

JDK 1.5+ Eclipse IDE Programming Environment