CS 0007 Introductory Programming George Novacky novackycs pitt

  • Slides: 13
Download presentation
CS 0007: Introductory Programming George Novacky novacky@cs. pitt. edu http: //courseweb. pitt. edu

CS 0007: Introductory Programming George Novacky novacky@cs. pitt. edu http: //courseweb. pitt. edu

What is a program? A program is a sequence of instructions that tells the

What is a program? A program is a sequence of instructions that tells the computer what to do tells another human being what you want the computer to do More formally, a program implements an algorithm. Algorithm: a finite set of well-defined instructions for accomplishing some task Wikipedia

Program Tasks Programs are written for various kinds of tasks (not mutually exclusive) solve

Program Tasks Programs are written for various kinds of tasks (not mutually exclusive) solve a problem create a simulation create a game produce an animation

What is a language? A system for communicating. Written languages use symbols (that is,

What is a language? A system for communicating. Written languages use symbols (that is, characters) to build words. Parts of Language Vocabulary: The entire set of words in the language. Syntax and grammar: The ways in which the words can be meaningfully combined Semantics: The actual meaning of words and combinations of words Java Vocabulary

Computer Languages Human languages are natural languages. Computers are not sophisticated enough to understand

Computer Languages Human languages are natural languages. Computers are not sophisticated enough to understand natural languages. In mathematics, logic and computer science, a formal language is a set of finite-length words (i. e. character strings) drawn from some finite alphabet, with carefully defined vocabulary, syntax, and semantics There are many different kinds of computer languages, including machine languages, programming languages, and fourth-generation languages.

Learning to write a program A program is written using a programming language We

Learning to write a program A program is written using a programming language We will learn to write programs using two languages Alice Java

Object Oriented Programming Different programming languages support different styles of programming In object-oriented programming,

Object Oriented Programming Different programming languages support different styles of programming In object-oriented programming, programmers can think of a program as instructions that tell interacting objects what to do An object is a model of some artifact (product of civilization) that can interact with other objects

Kinds of Animations Two kinds of animations: Movie Passive user watches the animation What

Kinds of Animations Two kinds of animations: Movie Passive user watches the animation What Alice Can Do Light. Demo Octopus Interactive Active user clicks on mouse, types a key on keyboard … Actions of user are called events Flight Simulator Skater

Objects An "object" is a model of an artifact and can be identified as

Objects An "object" is a model of an artifact and can be identified as unique from other things there can be multiple objects that are similar, but still unique How is an object unique? has a name has properties: width, height, color, location can perform actions (methods): associated actions it can perform tasks it can carry out

Object Parts Objects may be composed of parts (which are also objects)

Object Parts Objects may be composed of parts (which are also objects)

Class A class defines a particular kind of object Objects are categorized into classes

Class A class defines a particular kind of object Objects are categorized into classes Each object is an instance of the class. All objects in a class have similar properties and generally can perform the same tasks.

Galleries Classes (3 D models) are found in the galleries Local gallery (installed with

Galleries Classes (3 D models) are found in the galleries Local gallery (installed with the software) Minimum or complete options CD Gallery (only if CD is in the machine) Web gallery

Before next class Activity Launch Alice on your computer and run some of the

Before next class Activity Launch Alice on your computer and run some of the example worlds. Homework Read Alice Chapter 1. 1 and pages 73 - 74 for a brief introduction to objects