22
IMAT1604 Visual Web Development

What is an Object Anyway?

  • Upload
    helen

  • View
    59

  • Download
    2

Embed Size (px)

DESCRIPTION

What is an Object Anyway?. IMAT1604 Visual Web Development. What is an Object Anyway?. What is a word? Think about the following word… Shop What springs to mind?. A Specific Shop. The act of shopping…. Creating Instructions. - PowerPoint PPT Presentation

Citation preview

Page 1: What is an Object Anyway?

IMAT1604 Visual Web Development

Page 2: What is an Object Anyway?

What is an Object Anyway?What is a word?Think about the following word…

ShopWhat springs to mind?

Page 3: What is an Object Anyway?

A Specific Shop

Page 4: What is an Object Anyway?

The act of shopping…

Page 5: What is an Object Anyway?

Creating InstructionsA word on its own isn’t much use to us

however when we combine it with other words we can create instructions.

“I want you to go to the shop and get me a tin of peas.”

Page 6: What is an Object Anyway?

Words are Really Just SymbolsWhat is this?

Page 7: What is an Object Anyway?

What if we add other symbols?

Traffic lights and words on a page are all the same they are all symbols that we look at and assign meaning.

Page 8: What is an Object Anyway?

What is Programming?Programming is about using words and

symbols to communicate with a Computer

As with our example above we use words / symbols to create instructions or functions that the computer will follow and perform some task.

Functions are organised into classes – text files

Page 9: What is an Object Anyway?

Who is this?More to the point why is she so irritating?

We need to use the right words correctly

Page 10: What is an Object Anyway?

Most of us end up feeling more like this...

Page 11: What is an Object Anyway?

The Importance of Vocabulary“Shop, street, road, post box, lamp post, post code,

house, flat, house number, left, right ahead, distance, time, street sign, landmark.”

These words make up the vocabulary of the streets and roads. We are familiar with these words and can easily make up instructions (functions) using these words.

“You want to walk down that street for 10 meters then turn left at the post box. You will then see a sign to the railway station. Follow that sign for 5

meters and the shop is on the left.”

Page 12: What is an Object Anyway?

Computer Programming Introduces a new Vocabulary

“Class, object, assignment, sequence, variable, RAM, parameter, data type, function, method,

property, selection, sequence, integer, string.”

Page 13: What is an Object Anyway?

The Computer ProgrammerThe person who knows how to write the

correct words / symbols to tell the computer what to do

Computers copy and process dataData is made of binary numbersNobody really likes binaryWe need a set of commands to control data

Page 14: What is an Object Anyway?

First Look at Some C# CodeWhat is wrong with this?

Page 15: What is an Object Anyway?

The ProblemComputers are really fussySpotting errors can be difficult at firstThis gets easier with practiceTake a look at the following…

Int32 Name; - VariableName(); - Function“Name” - A string of letters.Name - A method or a property (Probably a property)//Name - A comment(Name) - A parameter

Page 16: What is an Object Anyway?

New Terms to UnderstandFunctionMethodPropertyClassInstantiationObject

Page 17: What is an Object Anyway?

Functions“A function is sequence of words and symbols

that instruct the computer to perform a single action on some data well.”

Page 18: What is an Object Anyway?

Methods and PropertiesMethod

A function that acts on the data in some way E.g. Multiply

PropertyA function that allows us to find out something

about the data or to set some aspect of it.E.g. Count

(This will be confusing at first!)

Page 19: What is an Object Anyway?

ClassesA class is a text file that contains related functions

making them easier to manageClasses are like recipe books

Recipe books dedicated to specific regionsClasses dedicated to specific sets of functionality

A student manager class might contain…

Methods .AddStudent .UpdateStudent .DeleteStudent

Properties .Count .HighestStudentGrade

Page 20: What is an Object Anyway?

So what is an Object Anyway?An object may be thought of as simply a word

that means something to the computer

The object in this code is MyStudentsMade up by the programmerAssociates the word with the class file

clsStudentsAllowing us to access the function/method

AddStudent

Page 21: What is an Object Anyway?

Instantiation

Stuff in green called commentsCreate an object MyCompter referencing the

code in the class file clsComputerInvokes the function/method TurnOffInstantiation is the act of creating an object

Page 22: What is an Object Anyway?

SummaryProgramming is the act of writing lists of words that

control the data in the system

We need a system for writing lists of instruction for the computer that makes reasonable sense to human beings

 We also have some key words for you to start getting to

grips with… 

Function A function is sequence of words that instruct the computer to perform a single action on some data well

Property A property is a function that tells us about or sets some aspect of the data

Method A method is a function that changes the data in some way

Class A class is a collection of related functions in a text file

Object An object is a word that references the code in the associated class

Instantiation The process of linking an object to a class