event driven programming

13
Objects Methods and Properties

Upload: cairo-richmond

Post on 02-Jan-2016

20 views

Category:

Documents


0 download

DESCRIPTION

Event Driven Programming. Objects Methods and Properties. Programming. Programming is the act of writing instructions that tell a computer how to do something. Sending a Simple Instruction to a Computer. I want the computer to shut down How would I do this? (Use of my senses) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Event Driven Programming

Objects Methods and Properties

Page 2: Event Driven Programming

ProgrammingProgramming is the act of writing instructions

that tell a computer how to do something.

Page 3: Event Driven Programming

Sending a Simple Instruction to a Computer

I want the computer to shut down

How would I do this?(Use of my senses)

How would I tell one of you to do it?(Use of natural language)

How do we tell the computer to turn itself off?

Page 4: Event Driven Programming

Natural Language and Computers“ok computer turn your self off now”

Does the computer understand the words we have used?

Strong regional accents?

Consider the following…Off computer turn nowOK puter turn thesel ov nowCmptr trn yrslf ff nw

Natural language allows for ambiguity and imprecision

Computers are really quite thick

Page 5: Event Driven Programming

Symbols and MeaningWe use symbols all of the time in our daily life

“Represents” the tune “three blind mice” but it isn’t the tune

South Nottingham CollegeHigh Road Beeston NG9 4AH

Represents the address but it isn’t the place

Page 6: Event Driven Programming

Which Code is Correct? Dim MyAge As Integer MyAge = 23 If MyAge > 21 Then lblError-Text = "You are old enough" End If

Or…

Dim MyAge As Integer MyAge = 23 If MyAge > 21 Then lblError.Text = "You are old enough" End If

Page 7: Event Driven Programming

Computer ProgrammingWe want to create:

A system that accurately identifies the individual components in a computer so we may control them

A system that may be used to set the sequence of instructions such that they are carried out in the way we intend

A system of representation that is easy to maintain avoiding unnecessary duplication and excess baggage

Something that is reasonably easy for us as human beings to write and understand (we don’t want the symbols to get in the way of the meaning)

Page 8: Event Driven Programming

Objects, Methods, Properties Lots of new terms to understand

Objects provide tools for referencing and controlling bits of the computer

Methods tell objects to do somethingProperties control the settings of an object

Page 9: Event Driven Programming

Cuba the Cat - MethodsRelease - let

Cuba outsideFeed - give

Cuba some food

Scoop - clean up after Cuba

Methods make the object do something

Page 10: Event Driven Programming

Cuba the Cat - PropertiesLegs 4Tails 1Ears 2Fangs 3

Properties tell us how the object is set up

Page 11: Event Driven Programming

The Computer as an ObjectWe want to represent and control the

computerView the computer system as a set of objects

MyComputer.TurnOff()

MyComputer represents the entire computerTurnOff is a method that turns the computer

off

Page 12: Event Driven Programming

Important Key ConceptsObject A way of representing computer

technology so that we may control it

Method Used to tell an object to do something

Property Used to find out or control something out about the

object, i.e colour.

Page 13: Event Driven Programming

Overview

Programming is the act of writing instructions that tell a computer how to do something

We need a standard system of notation allowing us to represent what the computer is to do that makes

reasonable sense to human beings