Download presentation
Presentation is loading. Please wait.
Published byRhoda Reynolds Modified over 8 years ago
2
CHAPTER 1 THE ABC OF PROGRAMMING
3
B
4
HOW DO COMPUTERS FIT IN WITH THE WORLD AROUND THEM?
5
Here is a model of a hotel, along with some trees, people, and cars.
6
To a human, it is clear what kind of real-world object each one represents. OBJECT TYPE: HOTELOBJECT TYPE: CAR
7
Computers create models of the world using data.
8
The objects in these models use properties, events, and methods.
9
PROPERTIES
10
Properties tell the computer about the characteristics of an object.
11
PROPERTIES nameQuay rating4 rooms42 bookings21 gymfalse pooltrue OBJECT TYPE: HOTEL
12
EVENTS
13
Events tell the computer how the user can interact with an object.
14
EVENThappens when: bookreservation is made cancelreservation is cancelled OBJECT TYPE: HOTEL
15
METHODS
16
Methods tell the computer how to change the properties of an object.
17
METHOD what it does: makeBooking() increases value of bookings PROPERTY cancelBooking() decreases value of bookings property checkAvailability() subtracts value of bookings property from value of rooms property and returns number of rooms available OBJECT TYPE: HOTEL
18
Here is the data the computer might use to make a model of one of the cars.
19
OBJECT TYPE: CAR EVENThappens when:method called: brakedriver slows downchangeSpeed() acceleratedriver speeds upchangeSpeed() METHODwhat it does: changeSpeed()increases or decreases value of currentSpeed property PROPERTIES makeBMW currentSpeed45mph colorsilver fueldiesel
20
OBJECT TYPE: CAR EVENThappens when:method called: brakedriver slows downchangeSpeed() acceleratedriver speeds upchangeSpeed() METHODwhat it does: changeSpeed()increases or decreases value of currentSpeed property PROPERTIES makeBMW currentSpeed45mph colorsilver fueldiesel
21
OBJECT TYPE: CAR EVENThappens when:method called: brakedriver slows downchangeSpeed() acceleratedriver speeds upchangeSpeed() METHODwhat it does: changeSpeed()increases or decreases value of currentSpeed property PROPERTIES makeBMW currentSpeed45mph colorsilver fueldiesel
22
OBJECT TYPE: CAR EVENThappens when:method called: brakedriver slows downchangeSpeed() acceleratedriver speeds upchangeSpeed() METHODwhat it does: changeSpeed()increases or decreases value of currentSpeed property PROPERTIES makeBMW currentSpeed45mph colorsilver fueldiesel
23
OBJECT TYPE: CAR EVENThappens when:method called: brakedriver slows downchangeSpeed() acceleratedriver speeds upchangeSpeed() METHODwhat it does: changeSpeed()increases or decreases value of currentSpeed property PROPERTIES makeBMW currentSpeed30mph colorsilver fueldiesel
24
WEB BROWSERS
25
Web browsers use models of the browser window and the web pages contained in them.
26
PROPERTIES locationhttp://www.javascriptbook.com/ OBJECT TYPE: WINDOW PROPERTIES URLhttp://www.javascriptbook.com/ lastModified09/04/2014 15:33:37 titleLearn JavaScript & jQuery - A book that teaches you in a nicer way OBJECT TYPE: DOCUMENT
27
Web browsers use these models to understand how to interpret web pages.
28
1
29
The browser receives a web page 1
30
Constructive & Co Constructive & Co For all orders and enquiries, please call 555-3344
31
2 The browser receives a web page 1
32
12 It creates a model of the page and stores it in memory
33
document OBJECT
34
document ELEMENT OBJECT
35
document Constructive & Co. For all orders and inquiries please call 555-3344 TEXT ELEMENT OBJECT
36
document Constructive & Co. For all orders and inquiries please call 555-3344 rel stylesheet href css/c01.css ATTRIBUTE TEXT ELEMENT OBJECT
37
3 The browser receives a web page 12 It creates a model of the page and stores it in memory
38
3 It shows the page on screen using a rendering engine The browser receives a web page 12 It creates a model of the page and stores it in memory
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.